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

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

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

--- trunk/RomCheater.PluginFramework/Core/ConfigPlugin.cs	2012/05/09 21:42:21	92
+++ trunk/RomCheater.PluginFramework/Core/ConfigPlugin.cs	2012/05/10 09:53:16	101
@@ -5,6 +5,8 @@
 using RomCheater.PluginFramework.Interfaces;
 using System.Diagnostics;
 using libWin32.Win32.Threading;
+using RomCheater.Logging;
+using System.IO;
 
 namespace RomCheater.PluginFramework.Core
 {
@@ -18,40 +20,52 @@
 
         public override void Reload()
         {
+            logger.Debug.WriteLine(" Loading config for {0}...", this.ToString());
             init();
+            logger.Debug.WriteLine(" Loaded config for {0}.", this.ToString());
         }
         private void init()
         {
             List<ProcContainer> proc_list = new List<ProcContainer>();
             foreach (Process proc in Process.GetProcesses())
             {
+                string proc_name = proc.ProcessName.ToLower();
                 try
                 {
                     bool isSystem = false;
-                    string proc_name = proc.ProcessName.ToLower();
                     string proc_user = ThreadControl.GetProcessOwner(proc.Handle, out isSystem).ToLower();
                     if (isSystem)
                     {
+                        logger.VerboseDebug.WriteLine("    not adding process {0} because it is a system process", proc_name);
                         continue;
                     }
                     ProcContainer container = null;
                     try
                     {
                         container = new ProcContainer(proc);
+                        logger.VerboseDebug.WriteLine("  adding process {0} ", proc_name);
+                        proc_list.Add(container);
                     }
-                    catch (Exception)
+                    catch (FileNotFoundException) { }
+                    catch (Exception ex)
                     {
-                        throw;
+                        //throw;
+                        logger.VerboseError.WriteLine("    not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString());
+                        //continue;
                     }
-                    proc_list.Add(container);
                 }
-                catch (System.ComponentModel.Win32Exception)
+                catch (System.ComponentModel.Win32Exception ex)
                 {
-                    continue;
+                    if (!((uint)ex.ErrorCode == 0x80004005))
+                    {
+                        logger.VerboseError.WriteLine("    not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString());
+                    }                   
+                    //continue;
                 }
-                catch (Exception)
+                catch (Exception ex)
                 {
-                    continue;
+                    logger.VerboseError.WriteLine("    not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString());
+                    //continue;
                 }
             }
             proc_list = proc_list.OrderBy(p => p.Name).ToList();
@@ -64,7 +78,7 @@
 
         #region IConfigPlugin Members
         public List<ProcContainer> ValidProcessesForPlugin { get; protected set; }
-        public override Guid Id
+        public override Guid ID
         {
             get { return new Guid(); }
         }

 

  ViewVC Help
Powered by ViewVC 1.1.22