From: Latif Khalifa Date: Sat, 8 May 2010 19:31:42 +0000 (+0000) Subject: Optimize startup time a bit by skipping scan for plugins in the files we know don... X-Git-Tag: 1.18~12 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=382b34565fe5d1197bdcaba56eb55a4b025848b8;p=radegast%2Fradegast.git Optimize startup time a bit by skipping scan for plugins in the files we know don't contain any. git-svn-id: https://radegast.googlecode.com/svn/trunk@617 f7a694da-4d33-11de-9ad6-1127a62b9fcd --- diff --git a/Radegast/Core/PluginInterface/PluginManager.cs b/Radegast/Core/PluginInterface/PluginManager.cs index 1472752..6c87e3b 100644 --- a/Radegast/Core/PluginInterface/PluginManager.cs +++ b/Radegast/Core/PluginInterface/PluginManager.cs @@ -66,6 +66,40 @@ namespace Radegast /// public class PluginManager : IDisposable { + /// List of files that should not be scanned for plugins + public static readonly List PluginBlackList = new List(new string[] + { + "AIMLbot.dll", + "Meebey.SmartIrc4net.dll", + "Monobjc.Cocoa.dll", + "Monobjc.dll", + "OpenMetaverse.Rendering.Meshmerizer.dll", + "OpenMetaverse.StructuredData.dll", + "OpenMetaverse.dll", + "OpenMetaverseTypes.dll", + "PrimMesher.dll", + "RadSpeechLin.dll", + "RadSpeechMac.dll", + "RadSpeechWin.dll", + "Tao.OpenGl.dll", + "Tao.Platform.Windows.dll", + "Tools.dll", + "XMLRPC.dll", + "fmodex-dotnet.dll", + "fmodex.dll", + "log4net.dll", + "openjpeg-dotnet-x86_64.dll", + "openjpeg-dotnet.dll" + }); + + /// List of file extensions that could potentially hold plugins + public static readonly List AllowedPluginExtensions = new List(new string[] + { + ".cs", + ".dll", + ".exe" + }); + List PluginsLoaded = new List(); RadegastInstance instance; @@ -214,12 +248,18 @@ namespace Radegast /// public void ScanAndLoadPlugins() { - string dirName = Application.StartupPath; + string dirName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (!Directory.Exists(dirName)) return; foreach (string loadFileName in Directory.GetFiles(dirName)) { + if (!AllowedPluginExtensions.Contains(Path.GetExtension(loadFileName).ToLower()) + || PluginBlackList.Contains(Path.GetFileName(loadFileName))) + { + continue; + } + LoadPluginFile(loadFileName, false); } }