/[RomCheater]/trunk/RomCheater.PluginFramework/Core/PluginLoader.cs
ViewVC logotype

Diff of /trunk/RomCheater.PluginFramework/Core/PluginLoader.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater.PluginFramework/Core/PluginLoader.cs	2012/06/10 02:53:09	365
+++ trunk/RomCheater.PluginFramework/Core/PluginLoader.cs	2012/06/10 03:14:42	366
@@ -18,31 +18,38 @@
             LoadedWindowPlugins = new List<IWindowPlugin>();
         }
         #region IPluginLoader Members
-
-        public void LoadPlugins()
+        public void LoadPlugins() { LoadPlugins(false); }
+        public void LoadPlugins(bool silent)
         {
             try
             {
-                logger.Info.WriteLine("Loading Plugins...");
+                if (!silent)
+                    logger.Info.WriteLine("Loading Plugins...");
 
                 string PluginPath = string.Format(@"{0}\Plugins", typeof(PluginLoader).Assembly.Location.Replace(@"\RomCheater.PluginFramework.dll", ""));
-                logger.Debug.WriteLine("Plugins Path: {0}", PluginPath);
+                if (!silent)
+                    logger.Debug.WriteLine("Plugins Path: {0}", PluginPath);
                 List<string> dlls = new List<string>(Directory.GetFiles(PluginPath, "*.dll"));
-                logger.Debug.WriteLine("  Found: {0} plugin dlls", dlls.Count);
+                if (!silent)
+                    logger.Debug.WriteLine("  Found: {0} plugin dlls", dlls.Count);
                 foreach (string dll in dlls)
                 {
                     FileInfo fi = new FileInfo(dll);
-                    logger.Debug.WriteLine("    plugin[{0}]: {1}", dlls.IndexOf(dll), fi.Name);
+                    if (!silent)
+                        logger.Debug.WriteLine("    plugin[{0}]: {1}", dlls.IndexOf(dll), fi.Name);
                     GetConfigPluginsFromDll(fi);
                     GetInputPluginsFromDll(fi);
                     GetWindowPluginsFromDll(fi);
                 }
 
-                logger.Info.WriteLine("  Loaded {0} config plugins", LoadedConfigPlugins.Count);
-                logger.Info.WriteLine("  Loaded {0} input plugins", LoadedInputPlugins.Count);
-                logger.Info.WriteLine("  Loaded {0} window plugins", LoadedWindowPlugins.Count);
-
-                logger.Info.WriteLine("Plugins Loaded.");
+                if (!silent)
+                    logger.Info.WriteLine("  Loaded {0} config plugins", LoadedConfigPlugins.Count);
+                if (!silent)
+                    logger.Info.WriteLine("  Loaded {0} input plugins", LoadedInputPlugins.Count);
+                if (!silent)
+                    logger.Info.WriteLine("  Loaded {0} window plugins", LoadedWindowPlugins.Count);
+                if (!silent)
+                    logger.Info.WriteLine("Plugins Loaded.");
             }
             catch (ReflectionTypeLoadException ex)
             {
@@ -54,11 +61,13 @@
                         builder.AppendLine(c.ToString());
                     }
                 }
-                logger.Error.WriteLine("Failed to load one or more plugins{0}Possible Reason:{0}{1}", System.Environment.NewLine, builder.ToString());
+                if (!silent)
+                    logger.Error.WriteLine("Failed to load one or more plugins{0}Possible Reason:{0}{1}", System.Environment.NewLine, builder.ToString());
             }
             catch (Exception ex)
             {
-                logger.Error.WriteLine("Failed to load one or more plugins{0}Possible Reason:{0}{1}", System.Environment.NewLine, ex.ToString());
+                if (!silent)
+                    logger.Error.WriteLine("Failed to load one or more plugins{0}Possible Reason:{0}{1}", System.Environment.NewLine, ex.ToString());
             }
         }
         public List<IConfigPlugin> LoadedConfigPlugins { get; private set; }
@@ -107,7 +116,7 @@
                 if (type.BaseType == typeof(ConfigPlugin))
                 {
                     ConstructorInfo ci = null;
-                    ci = type.GetConstructor(new Type[] {});
+                    ci = type.GetConstructor(new Type[] { });
                     if (ci == null)
                     {
                         throw new NullReferenceException(string.Format("Unable to bind to constructor for type: {0}", type.Name));

 

  ViewVC Help
Powered by ViewVC 1.1.22