示例#1
0
 public void UnloadPlugins()
 {
     if (PluginsDomain != null)
     {
         DynamicPlugins.Clear();
         AppDomain.Unload(PluginsDomain);
     }
 }
示例#2
0
        public void LoadExternalPlugins()
        {
            string pluginsDir = Path.Combine(Core.StartupPath, "Plugins", "bin");

            PluginsDomain = AppDomain.CreateDomain("plugins");

            PluginLoader loader =
                (PluginLoader)PluginsDomain.CreateInstanceAndUnwrap("ReiEditAA2", "ReiEditAA2.Plugins.PluginLoader");

            DynamicPlugins.Clear();
            foreach (string file in Directory.EnumerateFiles(pluginsDir, "*.dll"))
            {
                var plugins = loader.LoadPlugins(file);
                plugins.Select(plugin => new PluginMenu(plugin))
                .ForEach(modifier => DynamicPlugins.Add(modifier));
            }
        }