diff --git a/installer/additional_files/readme.txt b/installer/additional_files/readme.txt index bdb64e2c4..6b558bda2 100644 --- a/installer/additional_files/readme.txt +++ b/installer/additional_files/readme.txt @@ -7,10 +7,9 @@ CHANGE LOG: All details to our tickets can be found here: https://greenshot.atlassian.net -# Greenshot 1.3.xxx +# Greenshot 1.x.xxx Bugs fixed: -* greenshot.ini: Exclude Plugins and Include Plugins setting broken [#648](https://github.com/greenshot/greenshot/issues/648) [#642](https://github.com/greenshot/greenshot/issues/642) thanks to @Christian-Schulz for providing the fix Features added: @@ -669,4 +668,3 @@ Features added: * created textboxes can now be edited with a doubleclick [ 1704408 ] * selected font is now stored in the application config file [ 1704411 ] - diff --git a/src/Greenshot.Base/Greenshot.Base.csproj b/src/Greenshot.Base/Greenshot.Base.csproj index 550682cd0..7e55c1dbc 100644 --- a/src/Greenshot.Base/Greenshot.Base.csproj +++ b/src/Greenshot.Base/Greenshot.Base.csproj @@ -3,10 +3,6 @@ true - - none - false - diff --git a/src/Greenshot.Base/Interfaces/Plugin/AssemblyPluginIdentifierAttribute.cs b/src/Greenshot.Base/Interfaces/Plugin/AssemblyPluginIdentifierAttribute.cs deleted file mode 100644 index 2be14c7a8..000000000 --- a/src/Greenshot.Base/Interfaces/Plugin/AssemblyPluginIdentifierAttribute.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Greenshot - a free and open source screenshot tool - * Copyright (C) 2007-2025 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 -{ - /// - /// Attribute to specify a custom plugin identifier at assembly level - /// - [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] - public class AssemblyPluginIdentifierAttribute : Attribute - { - /// - /// The identifier used for the plugin in configuration - /// - public string Identifier { get; } - - /// - /// Constructor for the plugin identifier attribute - /// - /// The identifier for the plugin in configuration - public AssemblyPluginIdentifierAttribute(string identifier) - { - Identifier = identifier; - } - } -} \ No newline at end of file diff --git a/src/Greenshot.Editor/Greenshot.Editor.csproj b/src/Greenshot.Editor/Greenshot.Editor.csproj index 5dcd99bc1..7da9d555d 100644 --- a/src/Greenshot.Editor/Greenshot.Editor.csproj +++ b/src/Greenshot.Editor/Greenshot.Editor.csproj @@ -2,10 +2,6 @@ True - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Box/Greenshot.Plugin.Box.csproj b/src/Greenshot.Plugin.Box/Greenshot.Plugin.Box.csproj index 2b3410c8f..fced869ad 100644 --- a/src/Greenshot.Plugin.Box/Greenshot.Plugin.Box.csproj +++ b/src/Greenshot.Plugin.Box/Greenshot.Plugin.Box.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Box/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Box/Properties/AssemblyInfo.cs index 0379e4a65..2ffb6f6fd 100644 --- a/src/Greenshot.Plugin.Box/Properties/AssemblyInfo.cs +++ b/src/Greenshot.Plugin.Box/Properties/AssemblyInfo.cs @@ -21,13 +21,11 @@ using System.Reflection; using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyDescription("A plugin to upload images to Box")] -[assembly: AssemblyPluginIdentifier("Box Plugin")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. diff --git a/src/Greenshot.Plugin.Confluence/Greenshot.Plugin.Confluence.csproj b/src/Greenshot.Plugin.Confluence/Greenshot.Plugin.Confluence.csproj index 0734c44e9..d885ea3f5 100644 --- a/src/Greenshot.Plugin.Confluence/Greenshot.Plugin.Confluence.csproj +++ b/src/Greenshot.Plugin.Confluence/Greenshot.Plugin.Confluence.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Confluence/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Confluence/Properties/AssemblyInfo.cs deleted file mode 100644 index 8d2833e17..000000000 --- a/src/Greenshot.Plugin.Confluence/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Greenshot - a free and open source screenshot tool - * Copyright (C) 2007-2021 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel - * - * 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.Reflection; -using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyDescription("A plugin to upload images to Confluence")] -[assembly: AssemblyPluginIdentifier("Confluence Plugin")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/src/Greenshot.Plugin.Dropbox/Greenshot.Plugin.Dropbox.csproj b/src/Greenshot.Plugin.Dropbox/Greenshot.Plugin.Dropbox.csproj index 7437b64aa..09eb988a5 100644 --- a/src/Greenshot.Plugin.Dropbox/Greenshot.Plugin.Dropbox.csproj +++ b/src/Greenshot.Plugin.Dropbox/Greenshot.Plugin.Dropbox.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Dropbox/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Dropbox/Properties/AssemblyInfo.cs index b95b9af6d..d01359e25 100644 --- a/src/Greenshot.Plugin.Dropbox/Properties/AssemblyInfo.cs +++ b/src/Greenshot.Plugin.Dropbox/Properties/AssemblyInfo.cs @@ -21,13 +21,11 @@ using System.Reflection; using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyDescription("A plugin to upload images to Dropbox")] -[assembly: AssemblyPluginIdentifier("Dropbox Plugin")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. diff --git a/src/Greenshot.Plugin.ExternalCommand/Greenshot.Plugin.ExternalCommand.csproj b/src/Greenshot.Plugin.ExternalCommand/Greenshot.Plugin.ExternalCommand.csproj index d0151b7c0..50e39b62a 100644 --- a/src/Greenshot.Plugin.ExternalCommand/Greenshot.Plugin.ExternalCommand.csproj +++ b/src/Greenshot.Plugin.ExternalCommand/Greenshot.Plugin.ExternalCommand.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.ExternalCommand/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.ExternalCommand/Properties/AssemblyInfo.cs deleted file mode 100644 index acbe80370..000000000 --- a/src/Greenshot.Plugin.ExternalCommand/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Greenshot - a free and open source screenshot tool - * Copyright (C) 2007-2025 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel - * - * 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.Reflection; -using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyDescription("A plugin to send screenshots to other applications")] -[assembly: AssemblyPluginIdentifier("External command Plugin")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/src/Greenshot.Plugin.Flickr/Greenshot.Plugin.Flickr.csproj b/src/Greenshot.Plugin.Flickr/Greenshot.Plugin.Flickr.csproj index 8bdb8bcb4..5bc629bf1 100644 --- a/src/Greenshot.Plugin.Flickr/Greenshot.Plugin.Flickr.csproj +++ b/src/Greenshot.Plugin.Flickr/Greenshot.Plugin.Flickr.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Flickr/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Flickr/Properties/AssemblyInfo.cs index 9701ef654..30eafc83e 100644 --- a/src/Greenshot.Plugin.Flickr/Properties/AssemblyInfo.cs +++ b/src/Greenshot.Plugin.Flickr/Properties/AssemblyInfo.cs @@ -21,13 +21,11 @@ using System.Reflection; using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyDescription("A plugin to upload images to Flickr")] -[assembly: AssemblyPluginIdentifier("Flickr Plugin")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. diff --git a/src/Greenshot.Plugin.GooglePhotos/Greenshot.Plugin.GooglePhotos.csproj b/src/Greenshot.Plugin.GooglePhotos/Greenshot.Plugin.GooglePhotos.csproj index 154410dd2..f2bfb8be5 100644 --- a/src/Greenshot.Plugin.GooglePhotos/Greenshot.Plugin.GooglePhotos.csproj +++ b/src/Greenshot.Plugin.GooglePhotos/Greenshot.Plugin.GooglePhotos.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.GooglePhotos/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.GooglePhotos/Properties/AssemblyInfo.cs index 3ff014500..a49045818 100644 --- a/src/Greenshot.Plugin.GooglePhotos/Properties/AssemblyInfo.cs +++ b/src/Greenshot.Plugin.GooglePhotos/Properties/AssemblyInfo.cs @@ -21,17 +21,12 @@ using System.Reflection; using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyDescription("A plugin to upload images to GooglePhotos")] -// Still using the old name 'Picasa-Web Plugin' as identifier for backwards compatibility -// TODO: replace plugin identifier with "GooglePhotos Plugin" in the future -[assembly: AssemblyPluginIdentifier("Picasa-Web Plugin")] - // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. [assembly: ComVisible(false)] \ No newline at end of file diff --git a/src/Greenshot.Plugin.Imgur/Greenshot.Plugin.Imgur.csproj b/src/Greenshot.Plugin.Imgur/Greenshot.Plugin.Imgur.csproj index 5cb8e0baa..e0696e270 100644 --- a/src/Greenshot.Plugin.Imgur/Greenshot.Plugin.Imgur.csproj +++ b/src/Greenshot.Plugin.Imgur/Greenshot.Plugin.Imgur.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Imgur/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Imgur/Properties/AssemblyInfo.cs index 4f9d4afb5..befa881fd 100644 --- a/src/Greenshot.Plugin.Imgur/Properties/AssemblyInfo.cs +++ b/src/Greenshot.Plugin.Imgur/Properties/AssemblyInfo.cs @@ -21,13 +21,11 @@ using System.Reflection; using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyDescription("A plugin to upload images to Imgur")] -[assembly: AssemblyPluginIdentifier("Imgur Plugin")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. diff --git a/src/Greenshot.Plugin.Jira/Greenshot.Plugin.Jira.csproj b/src/Greenshot.Plugin.Jira/Greenshot.Plugin.Jira.csproj index d38eb063a..a06e33882 100644 --- a/src/Greenshot.Plugin.Jira/Greenshot.Plugin.Jira.csproj +++ b/src/Greenshot.Plugin.Jira/Greenshot.Plugin.Jira.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Jira/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Jira/Properties/AssemblyInfo.cs deleted file mode 100644 index 44f8800ce..000000000 --- a/src/Greenshot.Plugin.Jira/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Greenshot - a free and open source screenshot tool - * Copyright (C) 2007-2025 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel - * - * 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.Reflection; -using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyDescription("A plugin to upload images to Jira")] -[assembly: AssemblyPluginIdentifier("Jira Plugin")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/src/Greenshot.Plugin.Office/Greenshot.Plugin.Office.csproj b/src/Greenshot.Plugin.Office/Greenshot.Plugin.Office.csproj index 982b86833..347a58339 100644 --- a/src/Greenshot.Plugin.Office/Greenshot.Plugin.Office.csproj +++ b/src/Greenshot.Plugin.Office/Greenshot.Plugin.Office.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Office/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Office/Properties/AssemblyInfo.cs index 6b14a40f5..9dcc75892 100644 --- a/src/Greenshot.Plugin.Office/Properties/AssemblyInfo.cs +++ b/src/Greenshot.Plugin.Office/Properties/AssemblyInfo.cs @@ -21,13 +21,11 @@ using System.Reflection; using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyDescription("A plugin to export images to Office applications")] -[assembly: AssemblyPluginIdentifier("Office Plugin")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. diff --git a/src/Greenshot.Plugin.Photobucket/Greenshot.Plugin.Photobucket.csproj b/src/Greenshot.Plugin.Photobucket/Greenshot.Plugin.Photobucket.csproj index d0151b7c0..50e39b62a 100644 --- a/src/Greenshot.Plugin.Photobucket/Greenshot.Plugin.Photobucket.csproj +++ b/src/Greenshot.Plugin.Photobucket/Greenshot.Plugin.Photobucket.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Photobucket/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Photobucket/Properties/AssemblyInfo.cs index 231ca594d..783762320 100644 --- a/src/Greenshot.Plugin.Photobucket/Properties/AssemblyInfo.cs +++ b/src/Greenshot.Plugin.Photobucket/Properties/AssemblyInfo.cs @@ -21,14 +21,12 @@ using System.Reflection; using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyDescription("A plugin to upload images to Photobucket")] -[assembly: AssemblyPluginIdentifier("Photobucket Plugin")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. diff --git a/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj b/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj index 14126adb3..c1c1729e0 100644 --- a/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj +++ b/src/Greenshot.Plugin.Win10/Greenshot.Plugin.Win10.csproj @@ -1,8 +1,4 @@  - - none - false - PreserveNewest diff --git a/src/Greenshot.Plugin.Win10/Properties/AssemblyInfo.cs b/src/Greenshot.Plugin.Win10/Properties/AssemblyInfo.cs index 3f4b5bef2..d1b6cbd1b 100644 --- a/src/Greenshot.Plugin.Win10/Properties/AssemblyInfo.cs +++ b/src/Greenshot.Plugin.Win10/Properties/AssemblyInfo.cs @@ -1,33 +1,10 @@ -/* - * Greenshot - a free and open source screenshot tool - * Copyright (C) 2007-2025 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.Reflection; +using System.Reflection; using System.Runtime.InteropServices; -using Greenshot.Base.Interfaces.Plugin; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyDescription("A plug-in for Windows 10 only functionality")] -[assembly: AssemblyPluginIdentifier("Win10 Plugin")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from diff --git a/src/Greenshot/Greenshot.csproj b/src/Greenshot/Greenshot.csproj index f0d97afe9..0bda5ae2c 100644 --- a/src/Greenshot/Greenshot.csproj +++ b/src/Greenshot/Greenshot.csproj @@ -9,10 +9,6 @@ false false - - none - false - diff --git a/src/Greenshot/Helpers/PluginHelper.cs b/src/Greenshot/Helpers/PluginHelper.cs index e5724a4f5..3ed3d97c3 100644 --- a/src/Greenshot/Helpers/PluginHelper.cs +++ b/src/Greenshot/Helpers/PluginHelper.cs @@ -219,15 +219,18 @@ namespace Greenshot.Helpers { var assembly = Assembly.LoadFrom(pluginFile); - if (IsPluginExcludedByConfig(assembly, pluginFile) ) - { - continue; - } - var assemblyName = assembly.GetName().Name; + var pluginEntryName = $"{assemblyName}.{assemblyName.Replace("Greenshot.Plugin.", string.Empty)}Plugin"; var pluginEntryType = assembly.GetType(pluginEntryName, false, true); + 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}", pluginEntryName, assembly.GetName().Version, pluginFile); + continue; + } + var plugin = (IGreenshotPlugin) Activator.CreateInstance(pluginEntryType); if (plugin != null) { @@ -252,54 +255,5 @@ namespace Greenshot.Helpers } } } - /// - /// This method checks the plugin against the configured include and exclude plugin - /// lists. If a plugin is excluded, a warning is logged with details about the exclusion. - /// - private bool IsPluginExcludedByConfig(Assembly assembly, string pluginFile) - { - // Get plugin identifier from assembly attributes - string pluginConfigIdentifier = GetPluginIdentifier(assembly, pluginFile); - - if (CoreConfig.IncludePlugins is { } includePlugins - && includePlugins.Count(p => !string.IsNullOrWhiteSpace(p)) > 0 // ignore empty entries i.e. a whitespace - && !includePlugins.Contains(pluginConfigIdentifier)) - { - Log.WarnFormat("Include plugin list: {0}", string.Join(",", includePlugins)); - Log.WarnFormat("Skipping the not included plugin '{0}' with version {1} from {2}", pluginConfigIdentifier, assembly.GetName().Version, pluginFile); - return true; - } - - if (CoreConfig.ExcludePlugins is { } excludePlugins - && excludePlugins.Contains(pluginConfigIdentifier)) - { - Log.WarnFormat("Exclude plugin list: {0}", string.Join(",", excludePlugins)); - Log.WarnFormat("Skipping the excluded plugin '{0}' with version {1} from {2}", pluginConfigIdentifier, assembly.GetName().Version, pluginFile); - return true; - } - - return false; - } - - /// - /// Retrieves the plugin identifier for the specified assembly. - /// - private string GetPluginIdentifier(Assembly assembly, string pluginFile) - { - // Try to find PluginIdentifierAttribute - var attribute = assembly - .GetCustomAttributes() - .FirstOrDefault(); - - if (!string.IsNullOrEmpty(attribute?.Identifier)) - { - return attribute.Identifier; - } - - // If no attribute found, fall back to the sub namespace - var pluginSubNamespace = assembly.GetName().Name.Replace("Greenshot.Plugin.", string.Empty); - Log.WarnFormat("No '{0}' found in '{1}'. Use plugin namespace '{2}' as fallback.", nameof(AssemblyPluginIdentifierAttribute), pluginFile, pluginSubNamespace); - return pluginSubNamespace; - } } } \ No newline at end of file