Exemplo n.º 1
0
 /// <summary>
 /// 注销一个插件
 /// </summary>
 /// <param name="plugin">要注销的插件</param>
 public static void Unregister(IVisualNovelPlugin plugin)
 {
     foreach (var name in AssemblyRegister.GetInfo(plugin.GetType(), plugin))
     {
         if (!Plugins.ContainsKey(name.Name))
         {
             continue;
         }
         plugin.OnUnregister(false);
         Plugins.Remove(name.Name);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 注册一个插件
 /// <para>相同名称的插件会覆盖之前注册的插件</para>
 /// </summary>
 /// <param name="plugin">要注册的插件</param>
 public static void Register([NotNull] IVisualNovelPlugin plugin)
 {
     foreach (var name in AssemblyRegister.GetInfo(plugin.GetType(), plugin))
     {
         if (Plugins.ContainsKey(name.Name))
         {
             plugin.OnUnregister(true);
             Plugins.Remove(name.Name);
         }
         plugin.OnRegister();
         Plugins.Add(name.Name, plugin);
     }
 }