예제 #1
0
        public void CompileExternalPlugins()
        {
            string pluginsDir = Path.Combine(Core.StartupPath, "Plugins");

            AppDomain    compilerDomain = AppDomain.CreateDomain("compiler");
            PluginLoader compiler       =
                (PluginLoader)compilerDomain.CreateInstanceAndUnwrap("ReiEditAA2", "ReiEditAA2.Plugins.PluginLoader");

            foreach (string file in Directory.EnumerateFiles(pluginsDir, "*.cs"))
            {
                bool compiled = compiler.CompilePlugins(file);
                if (!compiled)
                {
                    MessageBox.Show(string.Format("Compilation Errors on '{0}', Check DynamicPlugin.txt for more information",
                                                  Path.GetFileName(file)),
                                    "Compilation Error",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Exclamation);
                }
            }
            AppDomain.Unload(compilerDomain);
        }