Ejemplo n.º 1
0
        private void InitializePluginCompiler()
        {
            Log.Write(Log.Levels.Debug, "CONF", "initializing plugin compiler...");
            string pluginRoot = Path.Combine(MFW3D.Global.Settings.DirectoryPath, "Plugins");

            compiler = new PluginCompiler(pluginRoot);
            //加载默认插件
            if (File.Exists(Application.StartupPath + "/Plugins.dll"))
            {
                Assembly assembly = Assembly.LoadFrom(Application.StartupPath + "/Plugins.dll");
                compiler.FindPlugins(assembly);
                compiler.FindPlugins();
                compiler.LoadStartupPlugins();
            }

            //加载所有插件的内容
            DirectoryInfo TheFolder = new DirectoryInfo(pluginRoot);

            foreach (FileInfo NextFile in TheFolder.GetFiles())
            {
                if (NextFile.Name.Length < 3)
                {
                    continue;
                }
                if (NextFile.Name.Substring(NextFile.Name.Length - 4, 4) != ".dll")
                {
                    continue;
                }
                Assembly assembly = Assembly.LoadFrom(
                    AppDomain.CurrentDomain.BaseDirectory + NextFile.Name);
                compiler.FindPlugins(assembly);
                compiler.FindPlugins();
                compiler.LoadStartupPlugins();
            }
        }
Ejemplo n.º 2
0
        private void InitializePluginCompiler()
        {
            Log.Write(Log.Levels.Debug, "CONF", "initializing plugin compiler...");
            this.splashScreen.SetText("Initializing plugins...");
            string pluginRoot = Path.Combine(PluginEngineGlobal.DirectoryPath, "Plugins");

            compiler = new PluginCompiler(pluginRoot);

            //#if DEBUG
            // Search for plugins in worldwind.exe (plugin development/debugging aid)
            //compiler.FindPlugins(Assembly.GetExecutingAssembly());
            Assembly assembly = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "WorldWind.exe");

            compiler.FindPlugins(assembly);
            //#endif

            compiler.FindPlugins();
            compiler.LoadStartupPlugins();
        }