//internal static void Initialize() //{ // if (mGlobalInstance == null) // { // mGlobalInstance = new PluginManager(true); // LoadPlugins(mGlobalInstance); // } // if (mProjectInstance != null) // { // foreach (IPlugin plugin in mProjectInstance.mPluginContainers.Keys) // { // ShutDownPlugin(plugin, PluginShutDownReason.GlueShutDown); // } // } // mProjectInstance = new PluginManager(false); // mInstances.Clear(); // mInstances.Add(mGlobalInstance); // mInstances.Add(mProjectInstance); // LoadPlugins(mProjectInstance); //} internal static void StartupPlugin(IPlugin plugin, PluginManager instance) { // See if the plugin already exists - it may implement multiple interfaces if (!instance.mPluginContainers.ContainsKey(plugin)) { PluginContainer pluginContainer = new PluginContainer(plugin); instance.mPluginContainers.Add(plugin, pluginContainer); try { plugin.UniqueId = plugin.GetType().FullName; if (!mPluginSettingsSave.DisabledPlugins.Contains(plugin.UniqueId)) { plugin.StartUp(); } else { pluginContainer.IsEnabled = false; } } catch (Exception e) { #if DEBUG MessageBox.Show("Plugin failed to start up:\n\n" + e.ToString()); #endif pluginContainer.Fail(e, "Plugin failed in StartUp"); } } }