QinSoft.Plugin 1.0.0

dotnet add package QinSoft.Plugin --version 1.0.0
NuGet\Install-Package QinSoft.Plugin -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="QinSoft.Plugin" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QinSoft.Plugin --version 1.0.0
#r "nuget: QinSoft.Plugin, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install QinSoft.Plugin as a Cake Addin
#addin nuget:?package=QinSoft.Plugin&version=1.0.0

// Install QinSoft.Plugin as a Cake Tool
#tool nuget:?package=QinSoft.Plugin&version=1.0.0

QinSoft.Plugin

QinSoft插件框架

PluginManager

通过使用应用域(AppDomain)实现插件的动态加载和调用,以及插件之间的数据通信。 实现类:

  1. PluginManagerImp

PluginObject

插件对象的抽象基类,通过继承该类创建具体插件对象,从而能够注入到QinSoft插件框架下。

PluginMonitor

插件监控,通过它监控插件包的动态变化来动态加载卸载插件。 实现类:

  1. PluginPackageMonitorImp

PluginApplication

插件应用程序,方便创建插件应用对象实例

测试代码

  • UnitTest.cs
    [Test]
    public void TestPluginApplication()
    {
        PluginApplication pluginApplication = new PluginApplication(new PluginPackageMonitorImp(), new PluginManagerImp());
        while (true)
        {
            Thread.Sleep(1000);
        }
    }
  • PluginObjectImp.cs
    public class PluginObjectImp : PluginObject
    {

        public PluginObjectImp()
        {
        }

        public override void Dispose()
        {

        }

        public override void HandleEvent(string eventKey, params string[] eventArgs)
        {
            Debug.WriteLine($"eventKey:{eventKey} eventArgs:{string.Join(",", eventArgs)}");
        }

        protected override void Execute()
        {
            NotifyManager(nameof(PluginObjectImp), "test");
        }
    }
  • plugin.json
{
    "Id" : "QinSoft.Plugin.Demo",
    "Name" : "QinSoft.Plugin.Demo",
    "Version" : "1.0",
    "Author" : "QinSoft",
    "ApplicationBase" : "./",
    "DynamicBase":"dynamic",
    "Assembly" : "QinSoft.Plugin.Demo",
    "Class" : "QinSoft.Plugin.Demo.PluginObjectImp"
}
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 415 4/27/2020