From d429e4f6afa7725f75bbfb6e5a8e17a4329519db Mon Sep 17 00:00:00 2001 From: Robin Krom Date: Tue, 18 May 2021 13:51:00 +0200 Subject: [PATCH] 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) --- installer/innosetup/setup.iss | 26 +++++---- src/Directory.Build.props | 31 +++++------ src/Greenshot.Base/GlobalSuppressions.cs | Bin 119362 -> 0 bytes src/Greenshot.Base/Greenshot.Base.csproj | 2 +- .../Interfaces/Plugin/IGreenshotPlugin.cs | 10 ++++ .../Interfaces/Plugin/PluginAttribute.cs | 50 ------------------ src/Greenshot.Plugin.Box/BoxPlugin.cs | 11 +++- src/Greenshot.Plugin.Box/BoxUtils.cs | 1 + .../Greenshot.Plugin.Box.csproj | 2 +- .../ConfluencePlugin.cs | 13 ++++- src/Greenshot.Plugin.Dropbox/DropboxPlugin.cs | 11 +++- .../Greenshot.Plugin.Dropbox.csproj | 2 +- .../ExternalCommandPlugin.cs | 13 ++++- src/Greenshot.Plugin.Flickr/FlickrPlugin.cs | 14 ++++- .../Greenshot.Plugin.Flickr.csproj | 2 +- .../GooglePhotosPlugin.cs | 11 +++- src/Greenshot.Plugin.Imgur/ImgurPlugin.cs | 33 +++++++----- .../Greenshot.Plugin.Jira.csproj | 4 +- src/Greenshot.Plugin.Jira/JiraPlugin.cs | 21 +++++--- src/Greenshot.Plugin.Office/OfficePlugin.cs | 13 ++++- .../PhotobucketPlugin.cs | 13 ++++- .../Greenshot.Plugin.Win10.csproj | 3 +- src/Greenshot.Plugin.Win10/Win10Plugin.cs | 11 +++- src/Greenshot.sln | 15 +----- src/Greenshot/Greenshot.csproj | 2 +- src/Greenshot/Helpers/PluginHelper.cs | 26 +++++---- 26 files changed, 189 insertions(+), 151 deletions(-) delete mode 100644 src/Greenshot.Base/GlobalSuppressions.cs delete mode 100644 src/Greenshot.Base/Interfaces/Plugin/PluginAttribute.cs diff --git a/installer/innosetup/setup.iss b/installer/innosetup/setup.iss index c08588ca5..ef2a2fc50 100644 --- a/installer/innosetup/setup.iss +++ b/installer/innosetup/setup.iss @@ -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 diff --git a/src/Directory.Build.props b/src/Directory.Build.props index e56ca9d63..f19f03423 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -21,16 +21,6 @@ true - - - - - - - false - true - - false true @@ -57,7 +47,7 @@ - + all runtime; build; native; contentfiles; analyzers @@ -110,13 +100,18 @@ + xcopy /f /y /d "$(TargetDir)$(TargetName).*" "$(SolutionDir)$(SolutionName)\$(OutDir)\Plugins\$(TargetName)" + xcopy /f /y /d "$(TargetDir)*.dll" "$(SolutionDir)$(SolutionName)\$(OutDir)\Plugins\$(TargetName)" + IF EXIST "$(TargetDir)Languages" ( + IF NOT EXIST "$(SolutionDir)$(SolutionName)\$(OutDir)Languages\$(TargetName)" ( + mkdir "$(SolutionDir)$(SolutionName)\$(OutDir)Languages\$(TargetName)" + ) + xcopy /f /y /d "$(TargetDir)Languages\*en-US.xml" "$(SolutionDir)$(SolutionName)\$(OutDir)Languages\$(TargetName)" + ) + for /f "tokens=*" %%F in ('dir /b /A-D $(SolutionDir)$(SolutionName)\$(OutDir)') do if EXIST "$(SolutionDir)$(SolutionName)\$(OutDir)\Plugins\$(TargetName)\%%F" ( echo %%F del "$(SolutionDir)$(SolutionName)\$(OutDir)\Plugins\$(TargetName)\%%F" ) + " /> diff --git a/src/Greenshot.Base/GlobalSuppressions.cs b/src/Greenshot.Base/GlobalSuppressions.cs deleted file mode 100644 index 148f8734d4145c7536cec4062f00e77f26868c14..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 119362 zcmeHQU2hx7mF?#M`455v3>?fv$z+2(1lR{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ceqi-5q1U?jMRh Z*fK}Od)yCuvkaiIPB8ukuS3W3_ - + diff --git a/src/Greenshot.Base/Interfaces/Plugin/IGreenshotPlugin.cs b/src/Greenshot.Base/Interfaces/Plugin/IGreenshotPlugin.cs index b61f49f44..ad968a5c3 100644 --- a/src/Greenshot.Base/Interfaces/Plugin/IGreenshotPlugin.cs +++ b/src/Greenshot.Base/Interfaces/Plugin/IGreenshotPlugin.cs @@ -22,5 +22,15 @@ namespace Greenshot.Base.Interfaces.Plugin /// Open the Configuration Form, will/should not be called before handshaking is done /// void Configure(); + + /// + /// Define the name of the plugin + /// + string Name { get; } + + /// + /// Specifies if the plugin can be configured + /// + bool IsConfigurable { get; } } } \ No newline at end of file diff --git a/src/Greenshot.Base/Interfaces/Plugin/PluginAttribute.cs b/src/Greenshot.Base/Interfaces/Plugin/PluginAttribute.cs deleted file mode 100644 index dd5fed129..000000000 --- a/src/Greenshot.Base/Interfaces/Plugin/PluginAttribute.cs +++ /dev/null @@ -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 . - */ - -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"); - } - } -} \ No newline at end of file diff --git a/src/Greenshot.Plugin.Box/BoxPlugin.cs b/src/Greenshot.Plugin.Box/BoxPlugin.cs index f94f0ed4a..71b2ad93b 100644 --- a/src/Greenshot.Plugin.Box/BoxPlugin.cs +++ b/src/Greenshot.Plugin.Box/BoxPlugin.cs @@ -35,7 +35,6 @@ namespace Greenshot.Plugin.Box /// /// This is the Box base code /// - [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); } + /// + /// Name of the plugin + /// + public string Name => "Box"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + private void Dispose(bool disposing) { if (!disposing) return; diff --git a/src/Greenshot.Plugin.Box/BoxUtils.cs b/src/Greenshot.Plugin.Box/BoxUtils.cs index 57dcc6ac8..af135fa2e 100644 --- a/src/Greenshot.Plugin.Box/BoxUtils.cs +++ b/src/Greenshot.Plugin.Box/BoxUtils.cs @@ -67,6 +67,7 @@ namespace Greenshot.Plugin.Box /// Title of box upload /// Filename of box upload /// url to uploaded image + /// TODO: Remove title und filename? public static string UploadToBox(SurfaceContainer image, string title, string filename) { // Fill the OAuth2Settings diff --git a/src/Greenshot.Plugin.Box/Greenshot.Plugin.Box.csproj b/src/Greenshot.Plugin.Box/Greenshot.Plugin.Box.csproj index 2b055bf08..fced869ad 100644 --- a/src/Greenshot.Plugin.Box/Greenshot.Plugin.Box.csproj +++ b/src/Greenshot.Plugin.Box/Greenshot.Plugin.Box.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Greenshot.Plugin.Confluence/ConfluencePlugin.cs b/src/Greenshot.Plugin.Confluence/ConfluencePlugin.cs index 6226493c0..e9dc34d41 100644 --- a/src/Greenshot.Plugin.Confluence/ConfluencePlugin.cs +++ b/src/Greenshot.Plugin.Confluence/ConfluencePlugin.cs @@ -33,7 +33,6 @@ namespace Greenshot.Plugin.Confluence /// /// This is the ConfluencePlugin base code /// - [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) {} } + /// + /// Name of the plugin + /// + public string Name => "Confluence"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + private static void CreateConfluenceConnector() { if (_confluenceConnector == null) diff --git a/src/Greenshot.Plugin.Dropbox/DropboxPlugin.cs b/src/Greenshot.Plugin.Dropbox/DropboxPlugin.cs index 4ee388ceb..9a82b0f40 100644 --- a/src/Greenshot.Plugin.Dropbox/DropboxPlugin.cs +++ b/src/Greenshot.Plugin.Dropbox/DropboxPlugin.cs @@ -34,7 +34,6 @@ namespace Greenshot.Plugin.Dropbox /// /// This is the Dropbox base code /// - [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; } + /// + /// Name of the plugin + /// + public string Name => "Dropbox"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + /// /// Implementation of the IGreenshotPlugin.Initialize /// diff --git a/src/Greenshot.Plugin.Dropbox/Greenshot.Plugin.Dropbox.csproj b/src/Greenshot.Plugin.Dropbox/Greenshot.Plugin.Dropbox.csproj index 28b675749..09eb988a5 100644 --- a/src/Greenshot.Plugin.Dropbox/Greenshot.Plugin.Dropbox.csproj +++ b/src/Greenshot.Plugin.Dropbox/Greenshot.Plugin.Dropbox.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Greenshot.Plugin.ExternalCommand/ExternalCommandPlugin.cs b/src/Greenshot.Plugin.ExternalCommand/ExternalCommandPlugin.cs index 966965029..7f576ccdd 100644 --- a/src/Greenshot.Plugin.ExternalCommand/ExternalCommandPlugin.cs +++ b/src/Greenshot.Plugin.ExternalCommand/ExternalCommandPlugin.cs @@ -34,7 +34,6 @@ namespace Greenshot.Plugin.ExternalCommand /// /// An Plugin to run commands after an image was written /// - [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; } + /// + /// Name of the plugin + /// + public string Name => "ExternalCommand"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + private IEnumerable Destinations() { foreach (string command in ExternalCommandConfig.Commands) diff --git a/src/Greenshot.Plugin.Flickr/FlickrPlugin.cs b/src/Greenshot.Plugin.Flickr/FlickrPlugin.cs index dff2a9f14..1939fba22 100644 --- a/src/Greenshot.Plugin.Flickr/FlickrPlugin.cs +++ b/src/Greenshot.Plugin.Flickr/FlickrPlugin.cs @@ -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 { /// /// This is the Flickr base code /// - [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; } + /// + /// Name of the plugin + /// + public string Name => "Flickr"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + /// /// Implementation of the IGreenshotPlugin.Initialize /// diff --git a/src/Greenshot.Plugin.Flickr/Greenshot.Plugin.Flickr.csproj b/src/Greenshot.Plugin.Flickr/Greenshot.Plugin.Flickr.csproj index 6fc040026..5bc629bf1 100644 --- a/src/Greenshot.Plugin.Flickr/Greenshot.Plugin.Flickr.csproj +++ b/src/Greenshot.Plugin.Flickr/Greenshot.Plugin.Flickr.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Greenshot.Plugin.GooglePhotos/GooglePhotosPlugin.cs b/src/Greenshot.Plugin.GooglePhotos/GooglePhotosPlugin.cs index 89b0b6aa5..fae06e516 100644 --- a/src/Greenshot.Plugin.GooglePhotos/GooglePhotosPlugin.cs +++ b/src/Greenshot.Plugin.GooglePhotos/GooglePhotosPlugin.cs @@ -34,7 +34,6 @@ namespace Greenshot.Plugin.GooglePhotos /// /// This is the GooglePhotos base code /// - [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; } + /// + /// Name of the plugin + /// + public string Name => "GooglePhotos"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + /// /// Implementation of the IGreenshotPlugin.Initialize /// diff --git a/src/Greenshot.Plugin.Imgur/ImgurPlugin.cs b/src/Greenshot.Plugin.Imgur/ImgurPlugin.cs index ee4a51b1f..d105916a2 100644 --- a/src/Greenshot.Plugin.Imgur/ImgurPlugin.cs +++ b/src/Greenshot.Plugin.Imgur/ImgurPlugin.cs @@ -37,7 +37,6 @@ namespace Greenshot.Plugin.Imgur /// /// This is the ImgurPlugin code /// - [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; } } + /// + /// Name of the plugin + /// + public string Name => "Imgur"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + private IEnumerable Destinations() { yield return new ImgurDestination(this); diff --git a/src/Greenshot.Plugin.Jira/Greenshot.Plugin.Jira.csproj b/src/Greenshot.Plugin.Jira/Greenshot.Plugin.Jira.csproj index 38d4d4073..a39835600 100644 --- a/src/Greenshot.Plugin.Jira/Greenshot.Plugin.Jira.csproj +++ b/src/Greenshot.Plugin.Jira/Greenshot.Plugin.Jira.csproj @@ -6,7 +6,7 @@ - - + + \ No newline at end of file diff --git a/src/Greenshot.Plugin.Jira/JiraPlugin.cs b/src/Greenshot.Plugin.Jira/JiraPlugin.cs index 162589527..e784f0ef8 100644 --- a/src/Greenshot.Plugin.Jira/JiraPlugin.cs +++ b/src/Greenshot.Plugin.Jira/JiraPlugin.cs @@ -35,7 +35,6 @@ namespace Greenshot.Plugin.Jira /// /// This is the JiraPlugin base code /// - [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?.Dispose(); - } + if (!disposing) return; + var jiraConnector = SimpleServiceProvider.Current.GetInstance(); + jiraConnector?.Dispose(); } + /// + /// Name of the plugin + /// + public string Name => "Jira"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + /// /// Implementation of the IGreenshotPlugin.Initialize /// diff --git a/src/Greenshot.Plugin.Office/OfficePlugin.cs b/src/Greenshot.Plugin.Office/OfficePlugin.cs index 78d2fb6f3..54eb25c22 100644 --- a/src/Greenshot.Plugin.Office/OfficePlugin.cs +++ b/src/Greenshot.Plugin.Office/OfficePlugin.cs @@ -31,7 +31,6 @@ namespace Greenshot.Plugin.Office /// /// This is the OfficePlugin base code /// - [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 } + /// + /// Name of the plugin + /// + public string Name => "Office"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => false; + private IEnumerable Destinations() { IDestination destination; diff --git a/src/Greenshot.Plugin.Photobucket/PhotobucketPlugin.cs b/src/Greenshot.Plugin.Photobucket/PhotobucketPlugin.cs index 7b6b51425..62a933a63 100644 --- a/src/Greenshot.Plugin.Photobucket/PhotobucketPlugin.cs +++ b/src/Greenshot.Plugin.Photobucket/PhotobucketPlugin.cs @@ -35,7 +35,6 @@ namespace Greenshot.Plugin.Photobucket /// /// This is the GreenshotPhotobucketPlugin base code /// - [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; } + /// + /// Name of the plugin + /// + public string Name => "Photobucket"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => true; + /// /// Implementation of the IGreenshotPlugin.Initialize /// diff --git a/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj b/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj index 822370739..349b4d79e 100644 --- a/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj +++ b/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj @@ -6,9 +6,10 @@ - + + diff --git a/src/Greenshot.Plugin.Win10/Win10Plugin.cs b/src/Greenshot.Plugin.Win10/Win10Plugin.cs index a89620ed2..6b15ff3c5 100644 --- a/src/Greenshot.Plugin.Win10/Win10Plugin.cs +++ b/src/Greenshot.Plugin.Win10/Win10Plugin.cs @@ -32,7 +32,6 @@ namespace Greenshot.Plugin.Win10 /// /// This is the Win10Plugin /// - [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(); } + /// + /// Name of the plugin + /// + public string Name => "Win10"; + + /// + /// Specifies if the plugin can be configured + /// + public bool IsConfigurable => false; + /// /// Implementation of the IGreenshotPlugin.Initialize /// diff --git a/src/Greenshot.sln b/src/Greenshot.sln index aae6365da..7013d3e41 100644 --- a/src/Greenshot.sln +++ b/src/Greenshot.sln @@ -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}" diff --git a/src/Greenshot/Greenshot.csproj b/src/Greenshot/Greenshot.csproj index da2c79714..757714790 100644 --- a/src/Greenshot/Greenshot.csproj +++ b/src/Greenshot/Greenshot.csproj @@ -72,7 +72,7 @@ - + diff --git a/src/Greenshot/Helpers/PluginHelper.cs b/src/Greenshot/Helpers/PluginHelper.cs index 86c4d2d2b..3ed3d97c3 100644 --- a/src/Greenshot/Helpers/PluginHelper.cs +++ b/src/Greenshot/Helpers/PluginHelper.cs @@ -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()) { - var pluginAttribute = plugin.GetType().GetCustomAttribute(); - 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().FirstOrDefault(p => - p.GetType().GetCustomAttribute().Name == pluginAttribute.Name); + var plugin = SimpleServiceProvider.Current + .GetAllInstances() + .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(); - 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