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 148f8734d..000000000
Binary files a/src/Greenshot.Base/GlobalSuppressions.cs and /dev/null differ
diff --git a/src/Greenshot.Base/Greenshot.Base.csproj b/src/Greenshot.Base/Greenshot.Base.csproj
index 2fcc89e72..c0bb88aff 100644
--- a/src/Greenshot.Base/Greenshot.Base.csproj
+++ b/src/Greenshot.Base/Greenshot.Base.csproj
@@ -6,7 +6,7 @@
-
+
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