private PluginTree(PluginOptions options) { this.Options = options ?? throw new ArgumentNullException(nameof(options)); this.Root = new PluginTreeNode(this); //创建插件加载器 this.Loader = new PluginLoader(new PluginResolver(this)); //侦听插件加载器的相关事件 this.Loader.Loaded += delegate(object sender, PluginLoadEventArgs args) { //设置插件树当前状态为“已初始化” this.Status = PluginTreeStatus.Loaded; }; this.Loader.Loading += delegate(object sender, PluginLoadEventArgs args) { //设置插件树当前状态为“已初始化” this.Status = PluginTreeStatus.Loading; //清空所有子节点 this.Root.Children.Clear(); }; AssemblyLoadContext.Default.Resolving += Default_Resolving; }
public PluginLoadingEventArgs(string pluginFile, PluginOptions options) : base(options) { if (string.IsNullOrEmpty(pluginFile)) { throw new ArgumentNullException(nameof(pluginFile)); } this.PluginFile = pluginFile; }
public static PluginTree Get(PluginOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } return(_instances.GetOrAdd(options, key => new PluginTree(key))); }
public PluginLoadEventArgs(PluginOptions options) { this.Options = options ?? throw new ArgumentNullException(nameof(options)); }
public PluginLoadedEventArgs(Plugin plugin, PluginOptions options) : base(options) { this.Plugin = plugin ?? throw new ArgumentNullException(nameof(plugin)); }