Пример #1
0
        private void RegisterPlugin(FileInfo assemblyFileInfo)
        {
            PhactoryHost.Plugin plugin = null;

            System.Reflection.Assembly assembly;
            try
            {
                assembly = System.Reflection.Assembly.LoadFrom(assemblyFileInfo.FullName);
            }
            catch
            {
                return;
            }

            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsClass && (type.GetInterface("PhactoryHost.Plugin") != null))
                {
                    plugin = Activator.CreateInstance(type) as PhactoryHost.Plugin;

                    if (App.Controller.UserConfig.VerboseOutput)
                    {
                        LogPluginInfo(plugin);
                    }

                    plugins.Add(plugin);
                    plugin.Register(host);
                }
            }
        }
Пример #2
0
        private void RegisterPlugins()
        {
            PhactoryHost.Plugin plugin = null;

            foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (type.IsClass && (type.GetInterface("PhactoryHost.Plugin") != null))
                {
                    plugin = Activator.CreateInstance(type) as PhactoryHost.Plugin;

                    if (App.Controller.UserConfig.VerboseOutput)
                    {
                        LogPluginInfo(plugin);
                    }

                    plugins.Add(plugin);
                    plugin.Register(host);
                }
            }
        }
Пример #3
0
        private void OK_Click(object sender, EventArgs e)
        {
            if (LastPlugin != null)
            {
                LastPlugin.SaveSettings();

                LastPlugin = null;
            }

            Close();

            App.Controller.UserConfig.LoadLastLoadedProject = this.loadLastLoadedProject.Checked;
            App.Controller.UserConfig.ReopenResources = this.reopenResources.Checked;
            App.Controller.UserConfig.MaximizeWindowAtStartup = this.maximizeWindowAtStartup.Checked;
            App.Controller.UserConfig.VerboseOutput = this.verboseOutput.Checked;
            App.Controller.UserConfig.SaveAllBeforeBuilding = this.saveAllBeforeBuilding.Checked;
            App.Controller.UserConfig.HideUnusedResourcesInProjectExplorer = this.hideUnusedResourcesInProjectExplorer.Checked;
            App.Controller.UserConfig.DontBuildBeforeRun = this.dontBuildBeforeRun.Checked;
            App.Controller.UserConfig.ProcessTimeoutInSec = int.Parse(this.ProcessTimeout.Text);

            if (this.fileMonitoring.Checked && (!App.Controller.UserConfig.FileMonitoring))
            {
                App.Controller.UserConfig.FileMonitoring = true;
                App.Controller.FileMonitor.Start();
            }
            else
            if ((!this.fileMonitoring.Checked) && App.Controller.UserConfig.FileMonitoring)
            {
                App.Controller.UserConfig.FileMonitoring = false;
                App.Controller.FileMonitor.Stop();
            }

            App.Controller.WriteUserConfig();

            App.Controller.View.RefreshDB();
        }
Пример #4
0
        private void plugins_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvPlugins.SelectedItems.Count == 0)
            {
                return;
            }

            if (LastPlugin != null)
            {
                LastPlugin.SaveSettings();
            }

            PhactoryHost.Plugin plugin = null;
            if (lvPlugins.SelectedItems.Count > 0)
            {
                plugin = App.Controller.PluginManager.GetPluginByName(lvPlugins.SelectedItems[0].Text);
            }
            LastPlugin = plugin;

            description.Text = plugin.GetDescription();

            PhactoryHost.ToolPlugin     toolPlugin     = plugin as PhactoryHost.ToolPlugin;
            PhactoryHost.EditorPlugin   editorPlugin   = plugin as PhactoryHost.EditorPlugin;
            PhactoryHost.CompilerPlugin compilerPlugin = plugin as PhactoryHost.CompilerPlugin;
            PhactoryHost.RunnerPlugin   runnerPlugin   = plugin as PhactoryHost.RunnerPlugin;

            if (toolPlugin != null)
            {
                type.Text = "Tool Module";
            }
            if (editorPlugin != null)
            {
                type.Text = "Editor Module";
            }
            if (compilerPlugin != null)
            {
                type.Text = "Build Module";
            }
            if (runnerPlugin != null)
            {
                type.Text = "Runner Module";
            }

            version.Text = "" + plugin.GetVersion();

            extensions.Items.Clear();

            defaultPluginForUnknownExtensions.Checked = false;

            List <PhactoryHost.PluginExtension> supportedExtensions = null;

            if (editorPlugin != null)
            {
                supportedExtensions = editorPlugin.GetSupportedExtensions();

                defaultPluginForUnknownExtensions.Checked = editorPlugin.IsDefaultPluginForUnknownTypes();
            }

            if (compilerPlugin != null)
            {
                supportedExtensions = compilerPlugin.GetSupportedExtensions();
            }

            if (runnerPlugin != null)
            {
                supportedExtensions = runnerPlugin.GetSupportedExtensions();
            }

            if (supportedExtensions != null)
            {
                foreach (PhactoryHost.PluginExtension supportedExtension in supportedExtensions)
                {
                    extensions.Items.Add(supportedExtension.GetName());
                }
            }
        }
Пример #5
0
        private void LogPluginInfo(PhactoryHost.Plugin plugin)
        {
            PhactoryHost.ToolPlugin     tool     = plugin as PhactoryHost.ToolPlugin;
            PhactoryHost.EditorPlugin   editor   = plugin as PhactoryHost.EditorPlugin;
            PhactoryHost.CompilerPlugin compiler = plugin as PhactoryHost.CompilerPlugin;
            PhactoryHost.RunnerPlugin   runner   = plugin as PhactoryHost.RunnerPlugin;

            if (tool != null)
            {
                App.Controller.Log.Append(plugin.GetName() + " " + plugin.GetVersion() + " (tool)");
            }
            else
            if (editor != null)
            {
                string extensions = "";

                foreach (PhactoryHost.PluginExtension supportedExtension in editor.GetSupportedExtensions())
                {
                    if (extensions.Length > 0)
                    {
                        extensions += ", ";
                    }
                    extensions += "*" + supportedExtension.GetName();
                }

                string text = plugin.GetName() + " " + plugin.GetVersion() + " (editor for " + extensions + ")";

                if (editor.IsDefaultPluginForUnknownTypes())
                {
                    text += " (also used as default editor for unknown types)";
                }

                App.Controller.Log.Append(text);
            }
            else if (compiler != null)
            {
                string extensions = "";

                foreach (PhactoryHost.PluginExtension supportedExtension in compiler.GetSupportedExtensions())
                {
                    if (extensions.Length > 0)
                    {
                        extensions += ", ";
                    }
                    extensions += "*" + supportedExtension.GetName();
                }

                App.Controller.Log.Append(plugin.GetName() + " " + plugin.GetVersion() + " (compiler for " + extensions + ")");
            }
            else if (runner != null)
            {
                string extensions = "";

                foreach (PhactoryHost.PluginExtension supportedExtension in runner.GetSupportedExtensions())
                {
                    if (extensions.Length > 0)
                    {
                        extensions += ", ";
                    }
                    extensions += "*" + supportedExtension.GetName();
                }

                App.Controller.Log.Append(plugin.GetName() + " " + plugin.GetVersion() + " (runner for " + extensions + ")");
            }
        }
Пример #6
0
        private void plugins_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvPlugins.SelectedItems.Count == 0)
            {
                return;
            }

            if (LastPlugin != null)
            {
                LastPlugin.SaveSettings();
            }

            PhactoryHost.Plugin plugin = null;
            if (lvPlugins.SelectedItems.Count>0)
            {
                plugin = App.Controller.PluginManager.GetPluginByName(lvPlugins.SelectedItems[0].Text);
            }
            LastPlugin = plugin;

            description.Text = plugin.GetDescription();

            PhactoryHost.ToolPlugin toolPlugin = plugin as PhactoryHost.ToolPlugin;
            PhactoryHost.EditorPlugin editorPlugin = plugin as PhactoryHost.EditorPlugin;
            PhactoryHost.CompilerPlugin compilerPlugin = plugin as PhactoryHost.CompilerPlugin;
            PhactoryHost.RunnerPlugin runnerPlugin = plugin as PhactoryHost.RunnerPlugin;

            if (toolPlugin != null) type.Text = "Tool Module";
            if (editorPlugin != null) type.Text = "Editor Module";
            if (compilerPlugin != null) type.Text = "Build Module";
            if (runnerPlugin != null) type.Text = "Runner Module";

            version.Text = "" + plugin.GetVersion();

            extensions.Items.Clear();

            defaultPluginForUnknownExtensions.Checked = false;

            List<PhactoryHost.PluginExtension> supportedExtensions = null;

            if (editorPlugin != null)
            {
                supportedExtensions = editorPlugin.GetSupportedExtensions();

                defaultPluginForUnknownExtensions.Checked = editorPlugin.IsDefaultPluginForUnknownTypes();
            }

            if (compilerPlugin != null)
            {
                supportedExtensions = compilerPlugin.GetSupportedExtensions();
            }

            if (runnerPlugin != null)
            {
                supportedExtensions = runnerPlugin.GetSupportedExtensions();
            }

            if (supportedExtensions != null)
            {
                foreach (PhactoryHost.PluginExtension supportedExtension in supportedExtensions)
                {
                    extensions.Items.Add(supportedExtension.GetName());
                }
            }
        }