From 89feff5da6243e69db6091ec1685aff488a7d059 Mon Sep 17 00:00:00 2001 From: waeberd Date: Fri, 29 Jul 2005 07:22:17 +0000 Subject: [PATCH] + INTERNAL: Don't activate ProcessPlugins, if no entry is found in MediaPortal.xml (cause Configuration.exe did not run) --- mediaportal/Core/guilib/PluginManager.cs | 48 +++++++++++++++--------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/mediaportal/Core/guilib/PluginManager.cs b/mediaportal/Core/guilib/PluginManager.cs index c8d668eecc2..9286f9eca33 100644 --- a/mediaportal/Core/guilib/PluginManager.cs +++ b/mediaportal/Core/guilib/PluginManager.cs @@ -186,12 +186,17 @@ static void LoadPlugin(string strFile) if (newObj==null) newObj=(object)Activator.CreateInstance(t); ISetupForm setup=(ISetupForm)newObj; - - if (IsPluginNameEnabled(setup.PluginName())) - { - _SetupForms.Add(setup); - _NonGUIPlugins.Add(plugin); - } + // waeberd: + // don't activate plugins that have NO entry at all in + // MediaPortal.xml + if (PluginEntryExists(setup.PluginName())) + { + if (IsPluginNameEnabled(setup.PluginName())) + { + _SetupForms.Add(setup); + _NonGUIPlugins.Add(plugin); + } + } } } catch( Exception iSetupFormException ) @@ -209,7 +214,7 @@ static void LoadPlugin(string strFile) if (newObj==null) newObj=(object)Activator.CreateInstance(t); IWakeable setup=(IWakeable)newObj; - if (IsPluginNameEnabled(setup.PluginName())) + if (IsPluginNameEnabled(setup.PluginName())) { _Wakeables.Add(setup); } @@ -294,7 +299,7 @@ static public void LoadWindowPlugin(string strFile) if (newObj==null) newObj=(object)Activator.CreateInstance(t); ISetupForm setup=(ISetupForm)newObj; - if (IsPluginNameEnabled(setup.PluginName())) + if (IsPluginNameEnabled(setup.PluginName())) { _SetupForms.Add(setup); } @@ -316,7 +321,7 @@ static public void LoadWindowPlugin(string strFile) if (newObj==null) newObj=(object)Activator.CreateInstance(t); IWakeable setup=(IWakeable)newObj; - if (IsPluginNameEnabled(setup.PluginName())) + if (IsPluginNameEnabled(setup.PluginName())) { _Wakeables.Add(setup); } @@ -373,16 +378,25 @@ static public bool IsWindowPlugInEnabled(string strType) } } - static public bool IsPluginNameEnabled(string strPluginName) - { + static public bool IsPluginNameEnabled(string strPluginName) + { - using (MediaPortal.Profile.Xml xmlreader=new MediaPortal.Profile.Xml("MediaPortal.xml")) - { - bool bEnabled=xmlreader.GetValueAsBool("plugins",strPluginName,true); - return bEnabled; + using (MediaPortal.Profile.Xml xmlreader=new MediaPortal.Profile.Xml("MediaPortal.xml")) + { + bool bEnabled=xmlreader.GetValueAsBool("plugins",strPluginName,true); + return bEnabled; - } - } + } + } + + static public bool PluginEntryExists(string strPluginName) + { + using (MediaPortal.Profile.Xml xmlreader=new MediaPortal.Profile.Xml("MediaPortal.xml")) + { + string val = xmlreader.GetValueAsString("plugins", strPluginName, ""); + return (val != ""); + } + } static public void WndProc(ref System.Windows.Forms.Message msg) // Receive window messages from core / added by mPod/waeberd {