Beispiel #1
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());
                }
            }
        }
Beispiel #2
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 + ")");
            }
        }