├── global.json ├── docs ├── logo.pdn ├── logo_256.png ├── Adafy_logo_256.png ├── logo_orange_white.png ├── logo_transparent_color.pdn ├── logo_transparent_color.png ├── logo_transparent_white.png └── logo_transparent_color_256.png ├── tests ├── integration │ ├── Weikio.PluginFramework.AspNetCore.IntegrationTests │ │ ├── xunit.runner.json │ │ ├── Weikio.PluginFramework.AspNetCore.IntegrationTests.csproj │ │ ├── TestBase.cs │ │ └── DefaultPluginTypeTests.cs │ ├── WebSites │ │ └── PluginFrameworkTestBed │ │ │ ├── PluginFrameworkTestBed.csproj │ │ │ ├── appsettings.Development.json │ │ │ ├── appsettings.json │ │ │ ├── WeatherForecast.cs │ │ │ ├── Program.cs │ │ │ ├── Controllers │ │ │ └── WeatherForecastController.cs │ │ │ └── Startup.cs │ └── Weikio.PluginFramework.Catalogs.NuGet.Tests │ │ ├── NuGet.Config │ │ ├── NotThreadSafeResourceCollection.cs │ │ └── Weikio.PluginFramework.Catalogs.NuGet.Tests.csproj ├── Assemblies │ ├── TestAssembly1 │ │ ├── NotAPlugin.cs │ │ ├── INotPluginInterface.cs │ │ ├── FirstPlugin.cs │ │ └── TestAssembly1.csproj │ ├── TestIntefaces │ │ ├── ICommand.cs │ │ ├── IJsonVersionResolver.cs │ │ └── TestIntefaces.csproj │ ├── TestAssembly3 │ │ ├── ThirdAddon.cs │ │ └── TestAssembly3.csproj │ ├── TestAssembly2 │ │ ├── SecondPlugin.cs │ │ └── TestAssembly2.csproj │ ├── JsonNetNew │ │ ├── NewJsonResolver.cs │ │ └── JsonNetNew.csproj │ └── JsonNetOld │ │ ├── JsonNetOld.csproj │ │ └── OldJsonResolver.cs └── unit │ ├── Weikio.PluginFramework.Tests │ ├── Plugins │ │ ├── TypePlugin.cs │ │ ├── PluginWithAttribute.cs │ │ ├── AnotherPluginWithAttribute.cs │ │ ├── AbstractPluginWithAttribute.cs │ │ ├── TypePluginWithName.cs │ │ └── MyPluginAttribute.cs │ ├── NotThreadSafeResourceCollection.cs │ ├── Weikio.PluginFramework.Tests.csproj │ ├── TypeFinderTests.cs │ ├── DefaultOptionsTests.cs │ └── TypePluginCatalogTests.cs │ └── Weikio.PluginFramework.Catalogs.Roslyn.Tests │ ├── Weikio.PluginFramework.Catalogs.Roslyn.Tests.csproj │ ├── TestHelpers.cs │ └── RegularInitializerTests.cs ├── samples ├── BlazorApp │ ├── wwwroot │ │ ├── favicon.ico │ │ └── css │ │ │ ├── open-iconic │ │ │ ├── font │ │ │ │ └── fonts │ │ │ │ │ ├── open-iconic.eot │ │ │ │ │ ├── open-iconic.otf │ │ │ │ │ ├── open-iconic.ttf │ │ │ │ │ └── open-iconic.woff │ │ │ ├── ICON-LICENSE │ │ │ ├── README.md │ │ │ └── FONT-LICENSE │ │ │ └── site.css │ ├── appsettings.json │ ├── appsettings.Development.json │ ├── _Imports.razor │ ├── Shared │ │ ├── MainLayout.razor │ │ ├── SurveyPrompt.razor │ │ └── NavMenu.razor │ ├── Data │ │ ├── WeatherForecast.cs │ │ └── WeatherForecastService.cs │ ├── App.razor │ ├── Properties │ │ └── launchSettings.json │ ├── Pages │ │ ├── Counter.razor │ │ ├── Error.razor │ │ ├── Index.razor │ │ ├── _Host.cshtml │ │ └── FetchData.razor │ ├── BlazorApp.csproj │ ├── Program.cs │ └── Startup.cs ├── WebAppPluginsLibrary │ ├── CustomPlugin.cs │ └── WebAppPluginsLibrary.csproj ├── Shared │ ├── Weikio.PluginFramework.Samples.Shared │ │ ├── IMyPlugin.cs │ │ ├── IOperator.cs │ │ ├── RemainderOperator.cs │ │ ├── IPlugin.cs │ │ └── Weikio.PluginFramework.Samples.Shared.csproj │ └── Weikio.PluginFramework.Samples.SharedPlugins │ │ ├── SumOperator.cs │ │ ├── MinusOperator.cs │ │ ├── SecondSharedPlugin.cs │ │ ├── MultiplyOperator.cs │ │ └── Weikio.PluginFramework.Samples.SharedPlugins.csproj ├── WebApp │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Properties │ │ └── launchSettings.json │ ├── Program.cs │ ├── WebApp.csproj │ ├── Controllers │ │ └── CalculatorController.cs │ └── Startup.cs ├── WebAppWithNuget │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Properties │ │ └── launchSettings.json │ ├── WebAppWithNuget.csproj │ ├── Program.cs │ ├── Controllers │ │ └── CalculatorController.cs │ ├── NugetLogger.cs │ └── Startup.cs ├── WebAppWithRoslyn │ ├── appsettings.Development.json │ ├── ExternalService.cs │ ├── appsettings.json │ ├── Properties │ │ └── launchSettings.json │ ├── Program.cs │ ├── WebAppWithRoslyn.csproj │ ├── Controllers │ │ └── RoslynController.cs │ └── Startup.cs ├── WebAppWithAppSettings │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Properties │ │ └── launchSettings.json │ ├── Program.cs │ ├── WebAppWithAppSettings.csproj │ ├── Startup.cs │ └── Controllers │ │ └── CalculatorController.cs ├── WebAppWithDelegate │ ├── appsettings.Development.json │ ├── ExternalService.cs │ ├── appsettings.json │ ├── Properties │ │ └── launchSettings.json │ ├── Program.cs │ ├── WebAppWithDelegate.csproj │ ├── Controllers │ │ └── DelegateController.cs │ └── Startup.cs ├── WpfApp │ ├── DivideOperator.cs │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── WpfApp.csproj │ ├── MainWindow.xaml │ └── MainWindow.xaml.cs ├── WinFormsApp │ ├── DivideOperator.cs │ ├── WinFormsApp.csproj │ └── Program.cs ├── ConsoleApp │ ├── FirstPlugin.cs │ ├── SecondPlugin.cs │ ├── MyPlugin.cs │ ├── ConsoleApp.csproj │ └── Program.cs └── WinFormsPluginsLibrary │ ├── LabelPlugin.cs │ ├── TestPlugin.cs │ ├── WinFormsPluginsLibrary.csproj │ ├── TestPlugin.Designer.cs │ └── LabelPlugin.Designer.cs ├── src ├── Weikio.PluginFramework │ ├── TypeFinding │ │ ├── ITypeFindingContext.cs │ │ ├── TypeFinderCriteria.cs │ │ ├── TypeFinderOptions.cs │ │ └── TypeFinderCriteriaBuilder.cs │ ├── Catalogs │ │ ├── Delegates │ │ │ ├── ParameterConversion.cs │ │ │ ├── DelegatePluginCatalogOptions.cs │ │ │ └── ConversionRule.cs │ │ ├── EmptyPluginCatalog.cs │ │ ├── AssemblyPluginCatalogOptions.cs │ │ ├── TypePluginCatalogOptions.cs │ │ ├── CompositePluginCatalog.cs │ │ └── FolderPluginCatalogOptions.cs │ ├── Context │ │ ├── RuntimeAssemblyHint.cs │ │ ├── UseHostApplicationAssembliesEnum.cs │ │ ├── MetadataTypeFindingContext.cs │ │ └── PluginLoadContextOptions.cs │ └── Weikio.PluginFramework.csproj ├── Weikio.PluginFramework.Abstractions │ ├── PluginFrameworkOptions.cs │ ├── IPluginCatalog.cs │ ├── Weikio.PluginFramework.Abstractions.csproj │ ├── IPluginCatalogExtensions.cs │ ├── Plugin.cs │ └── PluginNameOptions.cs ├── Weikio.PluginFramework.Configuration │ ├── CatalogConfiguration.cs │ ├── Converters │ │ ├── AssemblyCatalogConfigurationCoverter.cs │ │ ├── IConfigurationToCatalogConverter.cs │ │ └── FolderCatalogConfigurationConverter.cs │ ├── Providers │ │ ├── IPluginCatalogConfigurationLoader.cs │ │ └── PluginCatalogConfigurationLoader.cs │ └── Weikio.PluginFramework.Configuration.csproj ├── Weikio.PluginFramework.AspNetCore │ ├── DefaultPluginOption.cs │ ├── PluginExtensions.cs │ ├── ServiceProviderExtensions.cs │ ├── Weikio.PluginFramework.AspNetCore.csproj │ ├── PluginProvider.cs │ └── PluginFrameworkInitializer.cs ├── Weikio.PluginFramework.Catalogs.Roslyn │ ├── InvalidCodeException.cs │ ├── Weikio.PluginFramework.Catalogs.Roslyn.csproj │ ├── RoslynPluginCatalogOptions.cs │ ├── RegularInitializer.cs │ └── RoslynPluginCatalog.cs └── Weikio.PluginFramework.Catalogs.NuGet │ ├── Weikio.PluginFramework.Catalogs.NuGet.csproj │ ├── NugetFeedPluginCatalogOptions.cs │ ├── NugetPluginCatalogOptions.cs │ └── NugetFeedPluginCatalog.cs └── LICENSE /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "6.0.420" 4 | } 5 | } -------------------------------------------------------------------------------- /docs/logo.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/docs/logo.pdn -------------------------------------------------------------------------------- /docs/logo_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/docs/logo_256.png -------------------------------------------------------------------------------- /docs/Adafy_logo_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/docs/Adafy_logo_256.png -------------------------------------------------------------------------------- /docs/logo_orange_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/docs/logo_orange_white.png -------------------------------------------------------------------------------- /docs/logo_transparent_color.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/docs/logo_transparent_color.pdn -------------------------------------------------------------------------------- /docs/logo_transparent_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/docs/logo_transparent_color.png -------------------------------------------------------------------------------- /docs/logo_transparent_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/docs/logo_transparent_white.png -------------------------------------------------------------------------------- /docs/logo_transparent_color_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/docs/logo_transparent_color_256.png -------------------------------------------------------------------------------- /tests/integration/Weikio.PluginFramework.AspNetCore.IntegrationTests/xunit.runner.json: -------------------------------------------------------------------------------- 1 | { 2 | "shadowCopy": false 3 | } 4 | -------------------------------------------------------------------------------- /samples/BlazorApp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/samples/BlazorApp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /tests/Assemblies/TestAssembly1/NotAPlugin.cs: -------------------------------------------------------------------------------- 1 | namespace TestAssembly1 2 | { 3 | public abstract class NotAPlugin 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/Assemblies/TestIntefaces/ICommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TestIntefaces 4 | { 5 | public interface ICommand 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samples/WebAppPluginsLibrary/CustomPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace WebAppPluginsLibrary 4 | { 5 | public class CustomPlugin 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/Assemblies/TestAssembly1/INotPluginInterface.cs: -------------------------------------------------------------------------------- 1 | namespace TestAssembly1 2 | { 3 | public interface INotPluginInterface 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/Assemblies/TestAssembly3/ThirdAddon.cs: -------------------------------------------------------------------------------- 1 | using TestIntefaces; 2 | 3 | namespace TestAssembly3 4 | { 5 | public class ThirdAddon : ICommand 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Tests/Plugins/TypePlugin.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Tests.Plugins 2 | { 3 | public class TypePlugin 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/Assemblies/TestAssembly2/SecondPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TestAssembly2 4 | { 5 | public class SecondPlugin 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/Assemblies/TestIntefaces/IJsonVersionResolver.cs: -------------------------------------------------------------------------------- 1 | namespace TestIntefaces 2 | { 3 | public interface IJsonVersionResolver 4 | { 5 | string GetVersion(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /samples/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/samples/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /samples/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/samples/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /samples/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/samples/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /samples/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weikio/PluginFramework/HEAD/samples/BlazorApp/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.Shared/IMyPlugin.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Samples.Shared 2 | { 3 | public interface IMyPlugin 4 | { 5 | void Run(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Tests/Plugins/PluginWithAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Tests.Plugins 2 | { 3 | [MyPlugin] 4 | public class PluginWithAttribute 5 | { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.Shared/IOperator.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Samples.Shared 2 | { 3 | public interface IOperator 4 | { 5 | int Calculate(int x, int y); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /samples/WebAppPluginsLibrary/WebAppPluginsLibrary.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Tests/Plugins/AnotherPluginWithAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Tests.Plugins 2 | { 3 | [MyPlugin] 4 | public class AnotherPluginWithAttribute 5 | { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /samples/WebApp/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Tests/Plugins/AbstractPluginWithAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Tests.Plugins 2 | { 3 | [MyPlugin] 4 | public abstract class AbstractPluginWithAttribute 5 | { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samples/WebAppWithNuget/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/WebAppWithRoslyn/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/WebAppWithAppSettings/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/WebAppWithDelegate/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/integration/WebSites/PluginFrameworkTestBed/PluginFrameworkTestBed.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/BlazorApp/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /samples/WebApp/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /samples/WebAppWithNuget/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /samples/WebAppWithDelegate/ExternalService.cs: -------------------------------------------------------------------------------- 1 | namespace WebAppWithDelegate 2 | { 3 | public class ExternalService 4 | { 5 | public string GetWords() 6 | { 7 | return "Hello from external service"; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/WebAppWithDelegate/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /samples/WebAppWithRoslyn/ExternalService.cs: -------------------------------------------------------------------------------- 1 | namespace WebAppWithRoslyn 2 | { 3 | public class ExternalService 4 | { 5 | public string DoWork() 6 | { 7 | return "External service did some work"; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/WebAppWithRoslyn/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Tests/Plugins/TypePluginWithName.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Weikio.PluginFramework.Tests.Plugins 4 | { 5 | [DisplayName("MyCustomName")] 6 | public class TypePluginWithName 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/BlazorApp/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/integration/WebSites/PluginFrameworkTestBed/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/Assemblies/TestAssembly1/FirstPlugin.cs: -------------------------------------------------------------------------------- 1 | using TestIntefaces; 2 | 3 | namespace TestAssembly1 4 | { 5 | public class FirstPlugin : ICommand 6 | { 7 | public string RunMe() 8 | { 9 | return "Hello from RunMe"; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Tests/Plugins/MyPluginAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Weikio.PluginFramework.Tests.Plugins 4 | { 5 | [AttributeUsage(AttributeTargets.Class)] 6 | public class MyPluginAttribute : Attribute 7 | { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/integration/WebSites/PluginFrameworkTestBed/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /tests/integration/Weikio.PluginFramework.Catalogs.NuGet.Tests/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /samples/WpfApp/DivideOperator.cs: -------------------------------------------------------------------------------- 1 | using Weikio.PluginFramework.Samples.Shared; 2 | 3 | namespace WpfApp 4 | { 5 | public class DivideOperator : IOperator 6 | { 7 | public int Calculate(int x, int y) 8 | { 9 | return x / y; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/WinFormsApp/DivideOperator.cs: -------------------------------------------------------------------------------- 1 | using Weikio.PluginFramework.Samples.Shared; 2 | 3 | namespace WinFormsApp 4 | { 5 | public class DivideOperator : IOperator 6 | { 7 | public int Calculate(int x, int y) 8 | { 9 | return x / y; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/ConsoleApp/FirstPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Weikio.PluginFramework.Samples.Shared; 3 | 4 | namespace ConsoleApp 5 | { 6 | public class FirstPlugin : IPlugin 7 | { 8 | public void Run() 9 | { 10 | Console.WriteLine("First plugin"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /tests/Assemblies/TestIntefaces/TestIntefaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | ..\bin 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/ConsoleApp/SecondPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Weikio.PluginFramework.Samples.Shared; 3 | 4 | namespace ConsoleApp 5 | { 6 | public class SecondPlugin : IPlugin 7 | { 8 | public void Run() 9 | { 10 | Console.WriteLine("Second plugin"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.Shared/RemainderOperator.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Samples.Shared 2 | { 3 | public class RemainderOperator : IOperator 4 | { 5 | public int Calculate(int x, int y) 6 | { 7 | return x % y; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/Assemblies/TestAssembly2/TestAssembly2.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | ..\bin 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Tests/NotThreadSafeResourceCollection.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Weikio.PluginFramework.Tests 4 | { 5 | [CollectionDefinition(nameof(NotThreadSafeResourceCollection), DisableParallelization = true)] 6 | public class NotThreadSafeResourceCollection 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/ConsoleApp/MyPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Weikio.PluginFramework.Samples.Shared; 3 | 4 | namespace ConsoleApp 5 | { 6 | public class MyPlugin : IMyPlugin 7 | { 8 | public void Run() 9 | { 10 | Console.WriteLine("My plugin which implements IMyPlugin"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/TypeFinding/ITypeFindingContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Weikio.PluginFramework.TypeFinding 5 | { 6 | public interface ITypeFindingContext 7 | { 8 | Assembly FindAssembly(string assemblyName); 9 | Type FindType(Type type); 10 | } 11 | } -------------------------------------------------------------------------------- /tests/integration/Weikio.PluginFramework.Catalogs.NuGet.Tests/NotThreadSafeResourceCollection.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace PluginFramework.Catalogs.NuGet.Tests 4 | { 5 | [CollectionDefinition(nameof(NotThreadSafeResourceCollection), DisableParallelization = true)] 6 | public class NotThreadSafeResourceCollection { } 7 | } 8 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/Catalogs/Delegates/ParameterConversion.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Catalogs.Delegates 2 | { 3 | public class ParameterConversion 4 | { 5 | public bool ToConstructor { get; set; } 6 | public bool ToPublicProperty { get; set; } 7 | public string Name { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.SharedPlugins/SumOperator.cs: -------------------------------------------------------------------------------- 1 | using Weikio.PluginFramework.Samples.Shared; 2 | 3 | namespace Weikio.PluginFramework.Samples.SharedPlugins 4 | { 5 | public class SumOperator : IOperator 6 | { 7 | public int Calculate(int x, int y) 8 | { 9 | return x + y; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.SharedPlugins/MinusOperator.cs: -------------------------------------------------------------------------------- 1 | using Weikio.PluginFramework.Samples.Shared; 2 | 3 | namespace Weikio.PluginFramework.Samples.SharedPlugins 4 | { 5 | public class MinusOperator : IOperator 6 | { 7 | public int Calculate(int x, int y) 8 | { 9 | return x - y; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /samples/BlazorApp/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.JSInterop 8 | @using BlazorApp 9 | @using BlazorApp.Shared -------------------------------------------------------------------------------- /samples/BlazorApp/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
-------------------------------------------------------------------------------- /samples/BlazorApp/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorApp.Data 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int) (TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/BlazorApp/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
-------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.SharedPlugins/SecondSharedPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Weikio.PluginFramework.Samples.Shared; 3 | 4 | namespace Weikio.PluginFramework.Samples.SharedPlugins 5 | { 6 | public class SecondSharedPlugin : IOutPlugin 7 | { 8 | public string Get() 9 | { 10 | return "Second shared plugin"; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/WpfApp/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/Assemblies/JsonNetNew/NewJsonResolver.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using TestIntefaces; 3 | 4 | namespace JsonNetNew 5 | { 6 | public class NewJsonResolver : IJsonVersionResolver 7 | { 8 | public string GetVersion() 9 | { 10 | var result = typeof(JsonConvert).Assembly.GetName().Version.ToString(); 11 | 12 | return result; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/WpfApp/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace WpfApp 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/WebAppWithAppSettings/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "PluginFramework": { 3 | "Catalogs": [ 4 | { 5 | "Type": "Folder", 6 | "Path": "..\\Shared\\Weikio.PluginFramework.Samples.SharedPlugins\\bin\\debug\\netcoreapp3.1" 7 | }, 8 | { 9 | "Type": "Assembly", 10 | "Path": ".\\bin\\Debug\\netcoreapp3.1\\WebAppPluginsLibrary.dll" 11 | } 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/Assemblies/TestAssembly1/TestAssembly1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | ..\bin 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/Assemblies/TestAssembly3/TestAssembly3.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | ..\bin 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/integration/WebSites/PluginFrameworkTestBed/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PluginFrameworkTestBed 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int) (TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.Abstractions/PluginFrameworkOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Abstractions 2 | { 3 | /// 4 | /// Configures the options for Plugin Framework. 5 | /// 6 | public class PluginFrameworkOptions 7 | { 8 | public bool UseConfiguration { get; set; } = true; 9 | public string ConfigurationSection { get; set; } = "PluginFramework"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/BlazorApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "BlazorApp": { 5 | "commandName": "Project", 6 | "launchBrowser": true, 7 | "launchUrl": "", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | }, 11 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.SharedPlugins/MultiplyOperator.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Weikio.PluginFramework.Samples.Shared; 3 | 4 | namespace Weikio.PluginFramework.Samples.SharedPlugins 5 | { 6 | [DisplayName("The multiplier plugin")] 7 | public class MultiplyOperator : IOperator 8 | { 9 | public int Calculate(int x, int y) 10 | { 11 | return x * y; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.Configuration/CatalogConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Configuration 2 | { 3 | /// 4 | /// Base configuration class for catalogs. 5 | /// 6 | public class CatalogConfiguration 7 | { 8 | /// 9 | /// The type of the catalog this configuration section represents. 10 | /// 11 | public string? Type { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/WebApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "WebApp": { 5 | "commandName": "Project", 6 | "launchBrowser": true, 7 | "launchUrl": "Calculator", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | }, 11 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.AspNetCore/DefaultPluginOption.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Weikio.PluginFramework.AspNetCore 7 | { 8 | public class DefaultPluginOption 9 | { 10 | public Func, Type> DefaultType { get; set; } 11 | = (serviceProvider, implementingTypes) => implementingTypes.FirstOrDefault(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.Catalogs.Roslyn/InvalidCodeException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Weikio.PluginFramework.Catalogs.Roslyn 4 | { 5 | public class InvalidCodeException : Exception 6 | { 7 | public InvalidCodeException(Exception exception) : this("", exception) 8 | { 9 | } 10 | 11 | public InvalidCodeException(string message, Exception exception) : base(message, exception) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/WebAppWithNuget/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "WebAppWithNuget": { 5 | "commandName": "Project", 6 | "launchBrowser": true, 7 | "launchUrl": "Calculator", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | }, 11 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/WebAppWithRoslyn/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "WebAppWithRoslyn": { 5 | "commandName": "Project", 6 | "launchBrowser": true, 7 | "launchUrl": "Roslyn", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | }, 11 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/WebAppWithDelegate/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "WebAppWithDelegate": { 5 | "commandName": "Project", 6 | "launchBrowser": true, 7 | "launchUrl": "Delegate", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | }, 11 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/WebAppWithAppSettings/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "WebAppWithAppSettings": { 5 | "commandName": "Project", 6 | "launchBrowser": true, 7 | "launchUrl": "Calculator", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | }, 11 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/BlazorApp/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | @implements Weikio.PluginFramework.Samples.Shared.IWidget 3 | 4 |

Current count: @currentCount

5 | 6 | 7 | 8 | @code { 9 | private int currentCount = 0; 10 | 11 | private void IncrementCount() 12 | { 13 | currentCount++; 14 | } 15 | 16 | public string Title 17 | { 18 | get { return "Counter Widget"; } 19 | } 20 | } -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.Shared/IPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Weikio.PluginFramework.Samples.Shared 4 | { 5 | public interface IPlugin 6 | { 7 | void Run(); 8 | } 9 | 10 | public interface IOutPlugin 11 | { 12 | string Get(); 13 | } 14 | 15 | public interface IWidget 16 | { 17 | string Title { get; } 18 | } 19 | 20 | public interface IDialog 21 | { 22 | void Show(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/WpfApp/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/Context/RuntimeAssemblyHint.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Context 2 | { 3 | public class RuntimeAssemblyHint 4 | { 5 | public string FileName { get; set; } 6 | public string Path { get; set; } 7 | public bool IsNative { get; set; } 8 | 9 | public RuntimeAssemblyHint(string fileName, string path, bool isNative) 10 | { 11 | FileName = fileName; 12 | Path = path; 13 | IsNative = isNative; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/BlazorApp/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | @implements Weikio.PluginFramework.Samples.Shared.IWidget 2 | 10 | 11 | @code { 12 | public string Title { get; } = "Surveys"; 13 | } -------------------------------------------------------------------------------- /tests/Assemblies/JsonNetNew/JsonNetNew.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | ..\bin\JsonNew 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /samples/WinFormsPluginsLibrary/LabelPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows.Forms; 4 | using Weikio.PluginFramework.Samples.Shared; 5 | 6 | namespace WinFormsPluginsLibrary 7 | { 8 | public partial class LabelPlugin : Form, IDialog 9 | { 10 | public LabelPlugin() 11 | { 12 | InitializeComponent(); 13 | } 14 | 15 | private void button1_Click(object sender, EventArgs e) 16 | { 17 | label1.Text = "Another simple example"; 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /samples/WinFormsApp/WinFormsApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/WinFormsPluginsLibrary/TestPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows.Forms; 4 | using Weikio.PluginFramework.Samples.Shared; 5 | 6 | namespace WinFormsPluginsLibrary 7 | { 8 | [DisplayName("Hello World")] 9 | public partial class TestPlugin : Form, IDialog 10 | { 11 | public TestPlugin() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | private void button1_Click(object sender, EventArgs e) 17 | { 18 | MessageBox.Show("Hello Plugin Framework"); 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /tests/Assemblies/JsonNetOld/JsonNetOld.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | ..\bin\JsonOld 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /samples/WebAppWithDelegate/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | 4 | namespace WebAppWithDelegate 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IHostBuilder CreateHostBuilder(string[] args) => 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureWebHostDefaults(webBuilder => 16 | { 17 | webBuilder.UseStartup(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/WebAppWithRoslyn/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | 4 | namespace WebAppWithRoslyn 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IHostBuilder CreateHostBuilder(string[] args) => 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureWebHostDefaults(webBuilder => 16 | { 17 | webBuilder.UseStartup(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/WebAppWithAppSettings/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | 4 | namespace WebAppWithAppSettings 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IHostBuilder CreateHostBuilder(string[] args) => 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureWebHostDefaults(webBuilder => 16 | { 17 | webBuilder.UseStartup(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/ConsoleApp/ConsoleApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/WebAppWithNuget/WebAppWithNuget.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/WebApp/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.Hosting; 4 | 5 | namespace WebApp 6 | { 7 | public class Program 8 | { 9 | public static void Main(string[] args) 10 | { 11 | CreateHostBuilder(args).Build().Run(); 12 | } 13 | 14 | public static IHostBuilder CreateHostBuilder(string[] args) => 15 | Host.CreateDefaultBuilder(args) 16 | .ConfigureWebHostDefaults(webBuilder => 17 | { 18 | webBuilder.UseStartup(); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /samples/WebAppWithDelegate/WebAppWithDelegate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Never 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/WpfApp/WpfApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/BlazorApp/BlazorApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Never 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /samples/WinFormsPluginsLibrary/WinFormsPluginsLibrary.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | true 6 | 7 | 8 | 9 | 10 | Form 11 | 12 | 13 | Form 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/TypeFinding/TypeFinderCriteria.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Weikio.PluginFramework.TypeFinding 5 | { 6 | public class TypeFinderCriteria 7 | { 8 | public Type Inherits { get; set; } 9 | public Type Implements { get; set; } 10 | public Type AssignableTo { get; set; } 11 | public bool? IsAbstract { get; set; } 12 | public bool? IsInterface { get; set; } 13 | public string Name { get; set; } 14 | public Func Query { get; set; } 15 | public Type HasAttribute { get; set; } 16 | public List Tags { get; set; } = new List(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/WinFormsApp/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | using Weikio.PluginFramework.Context; 8 | 9 | namespace WinFormsApp 10 | { 11 | static class Program 12 | { 13 | /// 14 | /// The main entry point for the application. 15 | /// 16 | [STAThread] 17 | static void Main() 18 | { 19 | Application.SetHighDpiMode(HighDpiMode.SystemAware); 20 | Application.EnableVisualStyles(); 21 | Application.SetCompatibleTextRenderingDefault(false); 22 | Application.Run(new Form1()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Catalogs.Roslyn.Tests/Weikio.PluginFramework.Catalogs.Roslyn.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /samples/BlazorApp/Pages/Error.razor: -------------------------------------------------------------------------------- 1 | @page "/error" 2 | 3 | 4 |

Error.

5 |

An error occurred while processing your request.

6 | 7 |

Development Mode

8 |

9 | Swapping to Development environment will display more detailed information about the error that occurred. 10 |

11 |

12 | The Development environment shouldn't be enabled for deployed applications. 13 | It can result in displaying sensitive information from exceptions to end users. 14 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 15 | and restarting the app. 16 |

-------------------------------------------------------------------------------- /samples/WebAppWithRoslyn/WebAppWithRoslyn.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Never 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.AspNetCore/PluginExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Weikio.PluginFramework.Abstractions; 3 | 4 | // ReSharper disable once CheckNamespace 5 | namespace Microsoft.Extensions.DependencyInjection 6 | { 7 | public static class PluginExtensions 8 | { 9 | public static object Create(this Plugin plugin, IServiceProvider serviceProvider, params object[] parameters) 10 | { 11 | return ActivatorUtilities.CreateInstance(serviceProvider, plugin, parameters); 12 | } 13 | 14 | public static T Create(this Plugin plugin, IServiceProvider serviceProvider, params object[] parameters) where T : class 15 | { 16 | return ActivatorUtilities.CreateInstance(serviceProvider, plugin, parameters) as T; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.AspNetCore/ServiceProviderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Weikio.PluginFramework.Abstractions; 5 | 6 | // ReSharper disable once CheckNamespace 7 | namespace Microsoft.Extensions.DependencyInjection 8 | { 9 | public static class ServiceProviderExtensions 10 | { 11 | public static object Create(this IServiceProvider serviceProvider, Plugin plugin) 12 | { 13 | return ActivatorUtilities.CreateInstance(serviceProvider, plugin); 14 | } 15 | 16 | public static T Create(this IServiceProvider serviceProvider, Plugin plugin) where T : class 17 | { 18 | return ActivatorUtilities.CreateInstance(serviceProvider, plugin) as T; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/Context/UseHostApplicationAssembliesEnum.cs: -------------------------------------------------------------------------------- 1 | namespace Weikio.PluginFramework.Context 2 | { 3 | public enum UseHostApplicationAssembliesEnum 4 | { 5 | /// 6 | /// Never use user host application's assemblies 7 | /// 8 | Never, 9 | 10 | /// 11 | /// Only use the listed hosted application assemblies 12 | /// 13 | Selected, 14 | 15 | /// 16 | /// Always try to use host application's assemblies 17 | /// 18 | Always, 19 | 20 | /// 21 | /// Prefer plugin's referenced assemblies, fallback to host application's assemblies 22 | /// 23 | PreferPlugin 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Assemblies/JsonNetOld/OldJsonResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | using TestIntefaces; 4 | 5 | namespace JsonNetOld 6 | { 7 | public class OldJsonResolver : IJsonVersionResolver 8 | { 9 | public string GetVersion() 10 | { 11 | var result = typeof(JsonConvert).Assembly.GetName().Version.ToString(); 12 | 13 | return result; 14 | } 15 | 16 | public string GetLoggingVersion() 17 | { 18 | var logging = new Microsoft.Extensions.Logging.LoggerFactory(); 19 | Console.WriteLine(logging.ToString()); 20 | 21 | var result = typeof(Microsoft.Extensions.Logging.LoggerFactory).Assembly.GetName().Version.ToString(); 22 | 23 | return result; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/BlazorApp/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using Weikio.PluginFramework.Samples.Shared 3 | 4 | 5 |

Widget dashboard

6 |
7 | 8 | @foreach (var widget in Widgets) 9 | { 10 |
11 |
12 |

@widget.Title

13 |
14 | @RenderWidget(widget) 15 |
16 |
17 | } 18 |
19 | 20 | @code{ 21 | 22 | [Inject] 23 | public IEnumerable Widgets { get; set; } 24 | 25 | private RenderFragment RenderWidget(IWidget widget) 26 | { 27 | return new RenderFragment(builder => 28 | { 29 | builder.OpenComponent(0, widget.GetType()); 30 | builder.CloseComponent(); 31 | }); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.Shared/Weikio.PluginFramework.Samples.Shared.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | true 6 | true 7 | Plugin Framework shared sample 8 | Plugin Framework shared sample 9 | Plugin Framework shared sample 10 | Weikio.PluginFramework.Samples.Shared 11 | Weikio.PluginFramework.Samples.Shared 12 | Weikio.PluginFramework.Samples.Shared 13 | plugins;addons;plugin framework;samples 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /samples/WebAppWithNuget/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace WebAppWithNuget 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/WebApp/WebApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Never 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/integration/WebSites/PluginFrameworkTestBed/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace PluginFrameworkTestBed 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/BlazorApp/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace BlazorApp.Data 6 | { 7 | public class WeatherForecastService 8 | { 9 | private static readonly string[] Summaries = new[] 10 | { 11 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 12 | }; 13 | 14 | public Task GetForecastAsync(DateTime startDate) 15 | { 16 | var rng = new Random(); 17 | 18 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast 19 | { 20 | Date = startDate.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] 21 | }).ToArray()); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/BlazorApp/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Hosting; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace BlazorApp 13 | { 14 | public class Program 15 | { 16 | public static void Main(string[] args) 17 | { 18 | CreateHostBuilder(args).Build().Run(); 19 | } 20 | 21 | public static IHostBuilder CreateHostBuilder(string[] args) => 22 | Host.CreateDefaultBuilder(args) 23 | .ConfigureWebHostDefaults(webBuilder => 24 | { 25 | webBuilder.UseStartup(); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/integration/Weikio.PluginFramework.Catalogs.NuGet.Tests/Weikio.PluginFramework.Catalogs.NuGet.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | all 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/unit/Weikio.PluginFramework.Tests/Weikio.PluginFramework.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /samples/BlazorApp/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | 16 |
17 | 18 | @code { 19 | private bool collapseNavMenu = true; 20 | 21 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 22 | 23 | private void ToggleNavMenu() 24 | { 25 | collapseNavMenu = !collapseNavMenu; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/TypeFinding/TypeFinderOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace Weikio.PluginFramework.TypeFinding 5 | { 6 | public class TypeFinderOptions 7 | { 8 | /// 9 | /// Gets or sets the 10 | /// 11 | public List TypeFinderCriterias { get; set; } = new List(Defaults.GetDefaultTypeFinderCriterias()); 12 | 13 | public static class Defaults 14 | { 15 | public static List TypeFinderCriterias { get; set; } = new List(); 16 | 17 | public static ReadOnlyCollection GetDefaultTypeFinderCriterias() 18 | { 19 | return TypeFinderCriterias.AsReadOnly(); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /samples/WebAppWithAppSettings/WebAppWithAppSettings.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Never 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/WebAppWithNuget/Controllers/CalculatorController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Weikio.PluginFramework.Abstractions; 4 | using Weikio.PluginFramework.Samples.Shared; 5 | 6 | namespace WebAppWithNuget.Controllers 7 | { 8 | [ApiController] 9 | [Route("[controller]")] 10 | public class CalculatorController : ControllerBase 11 | { 12 | private readonly IEnumerable _operators; 13 | private readonly IEnumerable _plugins; 14 | 15 | public CalculatorController(IEnumerable operators, IEnumerable plugins, IOperator myOperator) 16 | { 17 | _operators = operators; 18 | _plugins = plugins; 19 | } 20 | 21 | [HttpGet] 22 | public string Get() 23 | { 24 | var pluginsList = string.Join(", ", _plugins); 25 | 26 | return pluginsList; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.Configuration/Converters/AssemblyCatalogConfigurationCoverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Extensions.Configuration; 3 | using Weikio.PluginFramework.Abstractions; 4 | using Weikio.PluginFramework.Catalogs; 5 | 6 | namespace Weikio.PluginFramework.Configuration.Converters 7 | { 8 | /// 9 | /// Converter implementation for the . 10 | /// 11 | public class AssemblyCatalogConfigurationCoverter : IConfigurationToCatalogConverter 12 | { 13 | /// 14 | public bool CanConvert(string type) 15 | { 16 | return string.Equals(type, "Assembly", StringComparison.InvariantCultureIgnoreCase); 17 | } 18 | 19 | /// 20 | public IPluginCatalog Convert(IConfigurationSection section) 21 | { 22 | var path = section.GetValue("Path"); 23 | 24 | return new AssemblyPluginCatalog(path); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.Configuration/Providers/IPluginCatalogConfigurationLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Extensions.Configuration; 3 | 4 | namespace Weikio.PluginFramework.Configuration.Providers 5 | { 6 | /// 7 | /// Interface that specified the methods a PluginCatalogConfigurationProvider needs. 8 | /// 9 | public interface IPluginCatalogConfigurationLoader 10 | { 11 | /// 12 | /// The key of the catalogs section inside the parent configuration section (). 13 | /// 14 | string CatalogsKey { get; } 15 | 16 | /// 17 | /// Returns a list that contains catalog configurations. 18 | /// 19 | /// The configuration to use. 20 | /// A list that contains catalog configurations. 21 | List GetCatalogConfigurations(IConfiguration configuration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/Catalogs/EmptyPluginCatalog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Threading.Tasks; 5 | using Weikio.PluginFramework.Abstractions; 6 | 7 | namespace Weikio.PluginFramework.Catalogs 8 | { 9 | /// 10 | /// Empty Plugin catalog. Doesn't contain anything, is automatically initialized when created. 11 | /// 12 | public class EmptyPluginCatalog : IPluginCatalog 13 | { 14 | /// 15 | public Task Initialize() 16 | { 17 | return Task.CompletedTask; 18 | } 19 | 20 | /// 21 | public bool IsInitialized { get; } = true; 22 | 23 | /// 24 | public List GetPlugins() 25 | { 26 | return new List(); 27 | } 28 | 29 | /// 30 | public Plugin Get(string name, Version version) 31 | { 32 | return null; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /samples/Shared/Weikio.PluginFramework.Samples.SharedPlugins/Weikio.PluginFramework.Samples.SharedPlugins.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | true 6 | true 7 | Plugin Framework shared sample plugins 8 | Plugin Framework shared sample plugins 9 | Plugin Framework shared sample plugins 10 | Weikio.PluginFramework.Samples.SharedPlugins 11 | Weikio.PluginFramework.Samples.SharedPlugins 12 | Weikio.PluginFramework.Samples.SharedPlugins 13 | plugins;addons;plugin framework;samples 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Weik.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.Abstractions/IPluginCatalog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Threading.Tasks; 5 | 6 | namespace Weikio.PluginFramework.Abstractions 7 | { 8 | /// 9 | /// Represents a single Plugin Catalog. Can contain 0-n plugins. 10 | /// 11 | public interface IPluginCatalog 12 | { 13 | /// 14 | /// Initializes the catalog 15 | /// 16 | Task Initialize(); 17 | 18 | /// 19 | /// Gets if the catalog is initialized 20 | /// 21 | bool IsInitialized { get; } 22 | 23 | /// 24 | /// Gets all the plugins 25 | /// 26 | /// List of 27 | List GetPlugins(); 28 | 29 | /// 30 | /// Gets a single plugin based on its name and version 31 | /// 32 | /// The 33 | Plugin Get(string name, Version version); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /samples/BlazorApp/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace BlazorApp.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = null; 6 | } 7 | 8 | 9 | 10 | 11 | 12 | 13 | BlazorApp 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | An error has occurred. This application may no longer respond until reloaded. 26 | 27 | 28 | An unhandled exception has occurred. See browser dev tools for details. 29 | 30 | Reload 31 | 🗙 32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.Abstractions/Weikio.PluginFramework.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | true 7 | Abstractions for Plugin Framework. 8 | Abstractions for Plugin Framework. 9 | Weikio.PluginFramework.Abstractions 10 | Weikio.PluginFramework.Abstractions 11 | Weikio.PluginFramework.Abstractions 12 | plugins;addons;extensions;plugin framework 13 | logo_transparent_color_256.png 14 | Plugin Framework Abstractions 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /samples/BlazorApp/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/Weikio.PluginFramework.Configuration/Converters/IConfigurationToCatalogConverter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Weikio.PluginFramework.Abstractions; 3 | 4 | namespace Weikio.PluginFramework.Configuration.Converters 5 | { 6 | /// 7 | /// Interface that specifies the methods a ConfigurationConverter needs. 8 | /// 9 | public interface IConfigurationToCatalogConverter 10 | { 11 | /// 12 | /// Determines if the converter can convert the provided type. 13 | /// True if it can, false otherwise. 14 | /// 15 | /// 16 | /// True if the type can be converted. 17 | bool CanConvert(string type); 18 | 19 | /// 20 | /// Convert a Catalog Configuration to it's equivalent object. 21 | /// 22 | /// The section that contains the catalog configuration. 23 | /// An equivalent object. 24 | IPluginCatalog Convert(IConfigurationSection section); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/Catalogs/Delegates/DelegatePluginCatalogOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using Weikio.PluginFramework.Abstractions; 5 | 6 | namespace Weikio.PluginFramework.Catalogs.Delegates 7 | { 8 | public class DelegatePluginCatalogOptions 9 | { 10 | public PluginNameOptions NameOptions { get; set; } = new PluginNameOptions(); 11 | public List ConversionRules { get; set; } = new List(); 12 | public string MethodName { get; set; } = "Run"; 13 | public string TypeName { get; set; } = "GeneratedType"; 14 | public string NamespaceName { get; set; } = "GeneratedNamespace"; 15 | public Func MethodNameGenerator { get; set; } = options => options.MethodName; 16 | public Func TypeNameGenerator { get; set; } = options => options.TypeName; 17 | public Func NamespaceNameGenerator { get; set; } = options => options.NamespaceName; 18 | public List Tags { get; set; } = new List(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Weikio.PluginFramework/Catalogs/Delegates/ConversionRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Weikio.PluginFramework.Catalogs.Delegates 5 | { 6 | public class DelegateConversionRule 7 | { 8 | private readonly Predicate _canHandle; 9 | private readonly Func _handle; 10 | 11 | public DelegateConversionRule(Predicate canHandle, Func handle) 12 | { 13 | if (canHandle == null) 14 | { 15 | throw new ArgumentNullException(nameof(canHandle)); 16 | } 17 | 18 | if (handle == null) 19 | { 20 | throw new ArgumentNullException(nameof(handle)); 21 | } 22 | 23 | _canHandle = canHandle; 24 | _handle = handle; 25 | } 26 | 27 | public bool CanHandle(ParameterInfo parameterInfo) 28 | { 29 | return _canHandle(parameterInfo); 30 | } 31 | 32 | public ParameterConversion Handle(ParameterInfo parameterInfo) 33 | { 34 | return _handle(parameterInfo); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /samples/WpfApp/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |