Removed the plugin attribute, and changed the way the plugins are copied to their destination. This should simplify the packaging, for InnoSetup but also the .zip & protable (which are still missing at this moment)

This commit is contained in:
Robin Krom 2021-05-18 13:51:00 +02:00
parent 8e121f25f0
commit d429e4f6af
No known key found for this signature in database
GPG key ID: BCC01364F1371490
26 changed files with 189 additions and 151 deletions

View file

@ -6,6 +6,7 @@
#define LanguagesDir "..\..\src\Greenshot\Languages"
#define BinDir "bin\Release\net472"
#define ReleaseDir "..\..\src\Greenshot\bin\Release\net472"
#define PluginDir "..\..\src\Greenshot\bin\Release\net472\Plugins"
; Include the scripts to install .NET Framework
; See https://www.codeproject.com/KB/install/dotnetfx_innosetup_instal.aspx
@ -24,8 +25,7 @@ Source: {#ReleaseDir}\Greenshot.Base.dll; DestDir: {app}; Components: greenshot;
Source: {#ReleaseDir}\Greenshot.Editor.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
Source: {#ReleaseDir}\Greenshot.exe.config; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
Source: {#ReleaseDir}\log4net.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
Source: {#ReleaseDir}\Dapplo.Http*.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
Source: {#ReleaseDir}\Dapplo.Log.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
Source: {#ReleaseDir}\Dapplo.*.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
Source: {#ReleaseDir}\Svg.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
Source: {#ReleaseDir}\Fizzler.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
Source: {#ReleaseDir}\HtmlAgilityPack.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
@ -81,35 +81,33 @@ Source: {#LanguagesDir}\*zh-CN*; Excludes: "*installer*,*website*"; DestDir: {ap
Source: {#LanguagesDir}\*zh-TW*; Excludes: "*installer*,*website*"; DestDir: {app}\Languages; Components: languages\zhTW; Flags: overwritereadonly ignoreversion replacesameversion;
;Office Plugin
Source: {#BaseDir}\Greenshot.Plugin.Office\{#BinDir}\Greenshot.Plugin.Office.dll; DestDir: {app}\Plugins\Office; Components: plugins\office; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.Office\*.dll; DestDir: {app}\Plugins\Office; Components: plugins\office; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
;JIRA Plugin
Source: {#BaseDir}\Greenshot.Plugin.Jira\{#BinDir}\Greenshot.Plugin.Jira.dll; DestDir: {app}\Plugins\Jira; Components: plugins\jira; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.Jira\{#BinDir}\Dapplo.Jira*.dll; DestDir: {app}\Plugins\Jira; Components: plugins\jira; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.Jira\*.dll; DestDir: {app}\Plugins\Jira; Components: plugins\jira; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.Jira\Languages\language_jira*.xml; DestDir: {app}\Languages\Plugins\Jira; Components: plugins\jira; Flags: overwritereadonly ignoreversion replacesameversion;
;Imgur Plugin
Source: {#BaseDir}\Greenshot.Plugin.Imgur\{#BinDir}\Greenshot.Plugin.Imgur.dll; DestDir: {app}\Plugins\Imgur; Components: plugins\imgur; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.Imgur\*.dll; DestDir: {app}\Plugins\Imgur; Components: plugins\imgur; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.Imgur\Languages\language_imgur*.xml; DestDir: {app}\Languages\Plugins\Imgur; Components: plugins\imgur; Flags: overwritereadonly ignoreversion replacesameversion;
;Box Plugin
Source: {#BaseDir}\Greenshot.Plugin.Box\{#BinDir}\Greenshot.Plugin.Box.dll; DestDir: {app}\Plugins\Box; Components: plugins\box; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.Box\*.dll; DestDir: {app}\Plugins\Box; Components: plugins\box; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.Box\Languages\language_box*.xml; DestDir: {app}\Languages\Plugins\Box; Components: plugins\box; Flags: overwritereadonly ignoreversion replacesameversion;
;DropBox Plugin
Source: {#BaseDir}\Greenshot.Plugin.DropBox\{#BinDir}\Greenshot.Plugin.DropBox.dll; DestDir: {app}\Plugins\DropBox; Components: plugins\dropbox; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.DropBox\*.dll; DestDir: {app}\Plugins\DropBox; Components: plugins\dropbox; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.DropBox\Languages\language_dropbox*.xml; DestDir: {app}\Languages\Plugins\DropBox; Components: plugins\dropbox; Flags: overwritereadonly ignoreversion replacesameversion;
;Flickr Plugin
Source: {#BaseDir}\Greenshot.Plugin.Flickr\{#BinDir}\Greenshot.Plugin.Flickr.dll; DestDir: {app}\Plugins\Flickr; Components: plugins\flickr; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.Flickr\*.dll; DestDir: {app}\Plugins\Flickr; Components: plugins\flickr; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.Flickr\Languages\language_flickr*.xml; DestDir: {app}\Languages\Plugins\Flickr; Components: plugins\flickr; Flags: overwritereadonly ignoreversion replacesameversion;
;Photobucket Plugin
Source: {#BaseDir}\Greenshot.Plugin.Photobucket\{#BinDir}\\Greenshot.Plugin.Photobucket.dll; DestDir: {app}\Plugins\Photobucket; Components: plugins\photobucket; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.Photobucket\*.dll; DestDir: {app}\Plugins\Photobucket; Components: plugins\photobucket; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.Photobucket\Languages\language_photo*.xml; DestDir: {app}\Languages\Plugins\Photobucket; Components: plugins\photobucket; Flags: overwritereadonly ignoreversion replacesameversion;
;Confluence Plugin
Source: {#BaseDir}\Greenshot.Plugin.Confluence\{#BinDir}\Greenshot.Plugin.Confluence.dll; DestDir: {app}\Plugins\Confluence; Components: plugins\confluence; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.Confluence\*.dll; DestDir: {app}\Plugins\Confluence; Components: plugins\confluence; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.Confluence\Languages\language_confluence*.xml; DestDir: {app}\Languages\Plugins\Confluence; Components: plugins\confluence; Flags: overwritereadonly ignoreversion replacesameversion;
;ExternalCommand Plugin
Source: {#BaseDir}\Greenshot.Plugin.ExternalCommand\{#BinDir}\Greenshot.Plugin.ExternalCommand.dll; DestDir: {app}\Plugins\ExternalCommand; Components: plugins\externalcommand; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.ExternalCommand\*.dll; DestDir: {app}\Plugins\ExternalCommand; Components: plugins\externalcommand; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.ExternalCommand\Languages\language_externalcommand*.xml; DestDir: {app}\Languages\Plugins\ExternalCommand; Components: plugins\externalcommand; Flags: overwritereadonly ignoreversion replacesameversion;
;Win 10 Plugin
Source: {#BaseDir}\Greenshot.Plugin.Win10\{#BinDir}\Greenshot.Plugin.Win10.dll; DestDir: {app}\Plugins\Win10; Components: plugins\win10; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#BaseDir}\Greenshot.Plugin.Win10\{#BinDir}\Microsoft.Toolkit.Uwp.Notifications.dll; DestDir: {app}\Plugins\Win10; Components: plugins\win10; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
Source: {#PluginDir}\Greenshot.Plugin.Win10\*.dll; DestDir: {app}\Plugins\Win10; Components: plugins\win10; Flags: overwritereadonly recursesubdirs ignoreversion replacesameversion;
[Setup]
; changes associations is used when the installer installs new extensions, it clears the explorer icon cache

View file

@ -21,16 +21,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>
<!-- ILLinker and single file settings -->
<ItemGroup Condition="$(MSBuildProjectName) == 'Greenshot'">
<TrimmerRootAssembly Include="netstandard" />
</ItemGroup>
<PropertyGroup Condition="$(MSBuildProjectName) == 'Greenshot'">
<IncludeSymbolsInSingleFile>false</IncludeSymbolsInSingleFile>
<ShowLinkerSizeComparison>true</ShowLinkerSizeComparison>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' != 'Debug' And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsPackable>true</IsPackable>
@ -57,7 +47,7 @@
</PropertyGroup>
<ItemGroup Condition="!$(MSBuildProjectName.Contains('Tests')) And $(MSBuildProjectName.StartsWith('Greenshot'))">
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37">
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.194">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
@ -110,13 +100,18 @@
<Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="$(MSBuildProjectName.StartsWith('Greenshot.Plugin.'))">
<Exec Command="
xcopy /f /y /d &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;
xcopy /f /y /d &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;
IF EXIST &quot;$(TargetDir)Languages&quot; (&#xD;&#xA;
IF NOT EXIST &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages&quot; (&#xD;&#xA;
mkdir &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages&quot;&#xD;&#xA;
IF NOT EXIST &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Plugins\$(TargetName)&quot; (&#xD;&#xA;
mkdir &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Plugins\$(TargetName)&quot;&#xD;&#xA;
)&#xD;&#xA;
xcopy /f /y /d &quot;$(TargetDir)Languages\*en-US.xml&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages&quot;&#xD;&#xA;
)" />
xcopy /f /y /d &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)\Plugins\$(TargetName)&quot;&#xD;&#xA;
xcopy /f /y /d &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)\Plugins\$(TargetName)&quot;&#xD;&#xA;
IF EXIST &quot;$(TargetDir)Languages&quot; (&#xD;&#xA;
IF NOT EXIST &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages\$(TargetName)&quot; (&#xD;&#xA;
mkdir &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages\$(TargetName)&quot;&#xD;&#xA;
)&#xD;&#xA;
xcopy /f /y /d &quot;$(TargetDir)Languages\*en-US.xml&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)Languages\$(TargetName)&quot;&#xD;&#xA;
)
for /f &quot;tokens=*&quot; %%F in ('dir /b /A-D $(SolutionDir)$(SolutionName)\$(OutDir)') do if EXIST &quot;$(SolutionDir)$(SolutionName)\$(OutDir)\Plugins\$(TargetName)\%%F&quot; (&#xD;&#xA;echo %%F&#xD;&#xA;del &quot;$(SolutionDir)$(SolutionName)\$(OutDir)\Plugins\$(TargetName)\%%F&quot;&#xD;&#xA;)&#xD;&#xA;
" />
</Target>
</Project>

View file

@ -6,7 +6,7 @@
<ItemGroup>
<PackageReference Include="Dapplo.HttpExtensions.JsonNet" Version="1.0.10" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.32" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.33" />
<PackageReference Include="log4net" version="2.0.12" />
<PackageReference Include="Svg" Version="3.2.3" />
<Reference Include="Accessibility" />

View file

@ -22,5 +22,15 @@ namespace Greenshot.Base.Interfaces.Plugin
/// Open the Configuration Form, will/should not be called before handshaking is done
/// </summary>
void Configure();
/// <summary>
/// Define the name of the plugin
/// </summary>
string Name { get; }
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
bool IsConfigurable { get; }
}
}

View file

@ -1,50 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2021 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: https://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using System;
namespace Greenshot.Base.Interfaces.Plugin
{
[Serializable]
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class PluginAttribute : Attribute, IComparable
{
public string Name { get; set; }
public bool Configurable { get; private set; }
public PluginAttribute(string name, bool configurable)
{
Name = name;
Configurable = configurable;
}
public int CompareTo(object obj)
{
if (obj is PluginAttribute other)
{
return string.Compare(Name, other.Name, StringComparison.Ordinal);
}
throw new ArgumentException("object is not a PluginAttribute");
}
}
}

View file

@ -35,7 +35,6 @@ namespace Greenshot.Plugin.Box
/// <summary>
/// This is the Box base code
/// </summary>
[Plugin("Box", true)]
public class BoxPlugin : IGreenshotPlugin
{
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(BoxPlugin));
@ -49,6 +48,16 @@ namespace Greenshot.Plugin.Box
GC.SuppressFinalize(this);
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Box";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
private void Dispose(bool disposing)
{
if (!disposing) return;

View file

@ -67,6 +67,7 @@ namespace Greenshot.Plugin.Box
/// <param name="title">Title of box upload</param>
/// <param name="filename">Filename of box upload</param>
/// <returns>url to uploaded image</returns>
/// TODO: Remove title und filename?
public static string UploadToBox(SurfaceContainer image, string title, string filename)
{
// Fill the OAuth2Settings

View file

@ -6,7 +6,7 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="box.png" />
<EmbeddedResource Include="box.png" />
</ItemGroup>
<ItemGroup>

View file

@ -33,7 +33,6 @@ namespace Greenshot.Plugin.Confluence
/// <summary>
/// This is the ConfluencePlugin base code
/// </summary>
[Plugin("Confluence", true)]
public class ConfluencePlugin : IGreenshotPlugin
{
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ConfluencePlugin));
@ -46,11 +45,21 @@ namespace Greenshot.Plugin.Confluence
GC.SuppressFinalize(this);
}
protected void Dispose(bool disposing)
private void Dispose(bool disposing)
{
//if (disposing) {}
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Confluence";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
private static void CreateConfluenceConnector()
{
if (_confluenceConnector == null)

View file

@ -34,7 +34,6 @@ namespace Greenshot.Plugin.Dropbox
/// <summary>
/// This is the Dropbox base code
/// </summary>
[Plugin("Dropbox", true)]
public class DropboxPlugin : IGreenshotPlugin
{
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(DropboxPlugin));
@ -56,6 +55,16 @@ namespace Greenshot.Plugin.Dropbox
_itemPlugInConfig = null;
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Dropbox";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>

View file

@ -6,7 +6,7 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Dropbox.gif" />
<EmbeddedResource Include="Dropbox.gif" />
</ItemGroup>
<ItemGroup>

View file

@ -34,7 +34,6 @@ namespace Greenshot.Plugin.ExternalCommand
/// <summary>
/// An Plugin to run commands after an image was written
/// </summary>
[Plugin("ExternalCommand", true)]
public class ExternalCommandPlugin : IGreenshotPlugin
{
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(ExternalCommandPlugin));
@ -48,7 +47,7 @@ namespace Greenshot.Plugin.ExternalCommand
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
private void Dispose(bool disposing)
{
if (!disposing) return;
if (_itemPlugInRoot == null) return;
@ -56,6 +55,16 @@ namespace Greenshot.Plugin.ExternalCommand
_itemPlugInRoot = null;
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "ExternalCommand";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
private IEnumerable<IDestination> Destinations()
{
foreach (string command in ExternalCommandConfig.Commands)

View file

@ -30,13 +30,13 @@ using Greenshot.Base.IniFile;
using Greenshot.Base.Interfaces;
using Greenshot.Base.Interfaces.Plugin;
using log4net;
using log4net.Config;
namespace Greenshot.Plugin.Flickr
{
/// <summary>
/// This is the Flickr base code
/// </summary>
[Plugin("Flickr", true)]
public class FlickrPlugin : IGreenshotPlugin
{
private static readonly ILog Log = LogManager.GetLogger(typeof(FlickrPlugin));
@ -50,7 +50,7 @@ namespace Greenshot.Plugin.Flickr
GC.SuppressFinalize(this);
}
protected void Dispose(bool disposing)
private void Dispose(bool disposing)
{
if (!disposing)
{
@ -66,6 +66,16 @@ namespace Greenshot.Plugin.Flickr
_itemPlugInConfig = null;
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Flickr";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>

View file

@ -6,7 +6,7 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="flickr.png" />
<EmbeddedResource Include="flickr.png" />
</ItemGroup>
<ItemGroup>

View file

@ -34,7 +34,6 @@ namespace Greenshot.Plugin.GooglePhotos
/// <summary>
/// This is the GooglePhotos base code
/// </summary>
[Plugin("GooglePhotos", true)]
public class GooglePhotosPlugin : IGreenshotPlugin
{
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(GooglePhotosPlugin));
@ -56,6 +55,16 @@ namespace Greenshot.Plugin.GooglePhotos
_itemPlugInRoot = null;
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "GooglePhotos";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>

View file

@ -37,7 +37,6 @@ namespace Greenshot.Plugin.Imgur
/// <summary>
/// This is the ImgurPlugin code
/// </summary>
[Plugin("Imgur", true)]
public class ImgurPlugin : IGreenshotPlugin
{
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(ImgurPlugin));
@ -52,24 +51,32 @@ namespace Greenshot.Plugin.Imgur
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
private void Dispose(bool disposing)
{
if (disposing)
if (!disposing) return;
if (_historyMenuItem != null)
{
if (_historyMenuItem != null)
{
_historyMenuItem.Dispose();
_historyMenuItem = null;
}
_historyMenuItem.Dispose();
_historyMenuItem = null;
}
if (_itemPlugInConfig != null)
{
_itemPlugInConfig.Dispose();
_itemPlugInConfig = null;
}
if (_itemPlugInConfig != null)
{
_itemPlugInConfig.Dispose();
_itemPlugInConfig = null;
}
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Imgur";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
private IEnumerable<IDestination> Destinations()
{
yield return new ImgurDestination(this);

View file

@ -6,7 +6,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Greenshot.Base\Greenshot.Base.csproj" />
<PackageReference Include="Dapplo.Jira" version="1.1.38" />
<PackageReference Include="Dapplo.Jira.SvgWinForms" Version="1.1.38" />
<PackageReference Include="Dapplo.Jira" version="1.1.38" />
<PackageReference Include="Dapplo.Jira.SvgWinForms" Version="1.1.38" />
</ItemGroup>
</Project>

View file

@ -35,7 +35,6 @@ namespace Greenshot.Plugin.Jira
/// <summary>
/// This is the JiraPlugin base code
/// </summary>
[Plugin("Jira", true)]
public class JiraPlugin : IGreenshotPlugin
{
private static readonly ILog Log = LogManager.GetLogger(typeof(JiraPlugin));
@ -47,15 +46,23 @@ namespace Greenshot.Plugin.Jira
GC.SuppressFinalize(this);
}
protected void Dispose(bool disposing)
private void Dispose(bool disposing)
{
if (disposing)
{
var jiraConnector = SimpleServiceProvider.Current.GetInstance<JiraConnector>();
jiraConnector?.Dispose();
}
if (!disposing) return;
var jiraConnector = SimpleServiceProvider.Current.GetInstance<JiraConnector>();
jiraConnector?.Dispose();
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Jira";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>

View file

@ -31,7 +31,6 @@ namespace Greenshot.Plugin.Office
/// <summary>
/// This is the OfficePlugin base code
/// </summary>
[Plugin("Office", false)]
public class OfficePlugin : IGreenshotPlugin
{
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OfficePlugin));
@ -42,11 +41,21 @@ namespace Greenshot.Plugin.Office
GC.SuppressFinalize(this);
}
protected void Dispose(bool disposing)
private void Dispose(bool disposing)
{
// Do nothing
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Office";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => false;
private IEnumerable<IDestination> Destinations()
{
IDestination destination;

View file

@ -35,7 +35,6 @@ namespace Greenshot.Plugin.Photobucket
/// <summary>
/// This is the GreenshotPhotobucketPlugin base code
/// </summary>
[Plugin("Photobucket", true)]
public class PhotobucketPlugin : IGreenshotPlugin
{
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(PhotobucketPlugin));
@ -49,7 +48,7 @@ namespace Greenshot.Plugin.Photobucket
GC.SuppressFinalize(this);
}
protected void Dispose(bool disposing)
private void Dispose(bool disposing)
{
if (!disposing) return;
if (_itemPlugInConfig == null) return;
@ -57,6 +56,16 @@ namespace Greenshot.Plugin.Photobucket
_itemPlugInConfig = null;
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Photobucket";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => true;
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>

View file

@ -6,9 +6,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" version="7.0.1" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" version="7.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Greenshot.Base\Greenshot.Base.csproj" />
</ItemGroup>
</Project>

View file

@ -32,7 +32,6 @@ namespace Greenshot.Plugin.Win10
/// <summary>
/// This is the Win10Plugin
/// </summary>
[Plugin("Win10", false)]
public sealed class Win10Plugin : IGreenshotPlugin
{
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(Win10Plugin));
@ -47,6 +46,16 @@ namespace Greenshot.Plugin.Win10
throw new NotImplementedException();
}
/// <summary>
/// Name of the plugin
/// </summary>
public string Name => "Win10";
/// <summary>
/// Specifies if the plugin can be configured
/// </summary>
public bool IsConfigurable => false;
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>

View file

@ -4,19 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 16.0.29728.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot", "Greenshot\Greenshot.csproj", "{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}"
ProjectSection(ProjectDependencies) = postProject
{92599C09-FF29-4ABD-B6E6-C48ECD781BAB} = {92599C09-FF29-4ABD-B6E6-C48ECD781BAB}
{19FEEF09-313F-43C7-819D-F1BCA782B08B} = {19FEEF09-313F-43C7-819D-F1BCA782B08B}
{9801F62C-540F-4BFE-9211-6405DEDE563B} = {9801F62C-540F-4BFE-9211-6405DEDE563B}
{9C0ECC4C-7807-4111-916A-4F57BB29788A} = {9C0ECC4C-7807-4111-916A-4F57BB29788A}
{C3052651-598A-44E2-AAB3-2E41311D50F9} = {C3052651-598A-44E2-AAB3-2E41311D50F9}
{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E} = {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}
{697CF066-9077-4F22-99D9-D989CCE7282B} = {697CF066-9077-4F22-99D9-D989CCE7282B}
{47F23C86-604E-4CC3-8767-B3D4088F30BB} = {47F23C86-604E-4CC3-8767-B3D4088F30BB}
{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50} = {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}
{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12} = {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}
{1893A2E4-A78A-4713-A8E7-E70058DABEE0} = {1893A2E4-A78A-4713-A8E7-E70058DABEE0}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Base", "Greenshot.Base\Greenshot.Base.csproj", "{5B924697-4DCD-4F98-85F1-105CB84B7341}"
EndProject
@ -46,6 +33,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
..\azure-pipelines.yml = ..\azure-pipelines.yml
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Greenshot.Editor", "Greenshot.Editor\Greenshot.Editor.csproj", "{148D3C8B-D6EC-4A7D-80E9-243A81F19DD2}"

View file

@ -72,7 +72,7 @@
<WriteLinesToFile File="$(SolutionDir)$(SolutionName)\$(OutDir)\checksum.SHA256" Lines="@(FilesWithHashes->'%(Filename)%(Extension): %(FileHash)')" Overwrite="true" WriteOnlyWhenDifferent="true" />
</Target>
<Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
<SetEnvironmentVariableTask Name="BuildVersionSimple" Value="$(BuildVersionSimple)" />
<SetEnvironmentVariableTask Name="AssemblyInformationalVersion" Value="$(AssemblyInformationalVersion)" />
<Exec Command="$(PkgTools_InnoSetup)\tools\ISCC.exe $(SolutionDir)\..\installer\innosetup\setup.iss" />

View file

@ -22,7 +22,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
@ -67,10 +66,9 @@ namespace Greenshot.Helpers
{
foreach (var plugin in SimpleServiceProvider.Current.GetAllInstances<IGreenshotPlugin>())
{
var pluginAttribute = plugin.GetType().GetCustomAttribute<PluginAttribute>();
var item = new ListViewItem(pluginAttribute.Name)
var item = new ListViewItem(plugin.Name)
{
Tag = pluginAttribute
Tag = plugin
};
var assembly = plugin.GetType().Assembly;
@ -89,8 +87,8 @@ namespace Greenshot.Helpers
return false;
}
var pluginAttribute = (PluginAttribute) listView.SelectedItems[0].Tag;
return pluginAttribute != null && pluginAttribute.Configurable;
var greenshotPlugin = (IGreenshotPlugin) listView.SelectedItems[0].Tag;
return greenshotPlugin?.IsConfigurable == true;
}
public void ConfigureSelectedItem(ListView listView)
@ -100,14 +98,15 @@ namespace Greenshot.Helpers
return;
}
var pluginAttribute = (PluginAttribute) listView.SelectedItems[0].Tag;
if (pluginAttribute == null)
var greenshotPlugin = (IGreenshotPlugin) listView.SelectedItems[0].Tag;
if (greenshotPlugin == null)
{
return;
}
var plugin = SimpleServiceProvider.Current.GetAllInstances<IGreenshotPlugin>().FirstOrDefault(p =>
p.GetType().GetCustomAttribute<PluginAttribute>().Name == pluginAttribute.Name);
var plugin = SimpleServiceProvider.Current
.GetAllInstances<IGreenshotPlugin>()
.FirstOrDefault(p => p.Name == greenshotPlugin.Name);
plugin?.Configure();
}
@ -224,12 +223,11 @@ namespace Greenshot.Helpers
var pluginEntryName = $"{assemblyName}.{assemblyName.Replace("Greenshot.Plugin.", string.Empty)}Plugin";
var pluginEntryType = assembly.GetType(pluginEntryName, false, true);
var pluginAttribute = pluginEntryType.GetCustomAttribute<PluginAttribute>();
if (CoreConfig.ExcludePlugins != null && CoreConfig.ExcludePlugins.Contains(pluginAttribute.Name))
if (CoreConfig.ExcludePlugins != null && CoreConfig.ExcludePlugins.Contains(pluginEntryName))
{
Log.WarnFormat("Exclude list: {0}", string.Join(",", CoreConfig.ExcludePlugins));
Log.WarnFormat("Skipping the excluded plugin {0} with version {1} from {2}", pluginAttribute.Name, assembly.GetName().Version, pluginFile);
Log.WarnFormat("Skipping the excluded plugin {0} with version {1} from {2}", pluginEntryName, assembly.GetName().Version, pluginFile);
continue;
}
@ -242,7 +240,7 @@ namespace Greenshot.Helpers
}
else
{
Log.InfoFormat("Plugin {0} not initialized!", pluginAttribute.Name);
Log.InfoFormat("Plugin {0} not initialized!", plugin.Name);
}
}
else