--- trunk/RomCheater.PluginFramework/Core/ConfigPlugin.cs 2012/05/27 23:59:22 150 +++ trunk/RomCheater.PluginFramework/Core/ConfigPlugin.cs 2012/05/28 00:17:16 151 @@ -1,4 +1,5 @@ -#define DISABLE_VERBOSE_LOGGING_FOR_PERFORMANCE_BOOST // when defined will disable verbose logging for performance speed-up +//#define DISABLE_VERBOSE_LOGGING_FOR_PERFORMANCE_BOOST // when defined will disable verbose logging for performance speed-up +#define DISALLOW_VERBOSE_LOGGING // when defined will disallow verbose logging for performance reasons using System; using System.Collections.Generic; using System.Linq; @@ -27,20 +28,20 @@ namespace RomCheater.PluginFramework.Cor } private void init() { - loggerflags flags = logger.GetLoggingFlags(); +// loggerflags flags = logger.GetLoggingFlags(); -#if DISABLE_VERBOSE_LOGGING_FOR_PERFORMANCE_BOOST - ushort performance_flags = flags.Value; - if (flags.HasFlag(loggerflags.VERBOSE_DEBUG)) - { - performance_flags = (ushort)(performance_flags &~ loggerflags.VERBOSE_DEBUG.Value); - } - if (flags.HasFlag(loggerflags.VERBOSE_ERROR)) - { - performance_flags = (ushort)(performance_flags &~ loggerflags.VERBOSE_ERROR.Value); - } -#endif - logger.SetLoggingFlags(performance_flags); +//#if DISABLE_VERBOSE_LOGGING_FOR_PERFORMANCE_BOOST +// ushort performance_flags = flags.Value; +// if (flags.HasFlag(loggerflags.VERBOSE_DEBUG)) +// { +// performance_flags = (ushort)(performance_flags &~ loggerflags.VERBOSE_DEBUG.Value); +// } +// if (flags.HasFlag(loggerflags.VERBOSE_ERROR)) +// { +// performance_flags = (ushort)(performance_flags &~ loggerflags.VERBOSE_ERROR.Value); +// } +//#endif +// logger.SetLoggingFlags(performance_flags); List proc_list = new List(); foreach (Process proc in Process.GetProcesses()) @@ -52,21 +53,27 @@ namespace RomCheater.PluginFramework.Cor string proc_user = ThreadControl.GetProcessOwner(proc.Handle, out isSystem).ToLower(); if (isSystem) { +#if !DISALLOW_VERBOSE_LOGGING logger.VerboseDebug.WriteLine(" not adding process {0} because it is a system process", proc_name); +#endif continue; } ProcContainer container = null; try { container = new ProcContainer(proc); + #if !DISALLOW_VERBOSE_LOGGING logger.VerboseDebug.WriteLine(" adding process {0} ", proc_name); +#endif proc_list.Add(container); } catch (FileNotFoundException) { } catch (Exception ex) { //throw; + #if !DISALLOW_VERBOSE_LOGGING logger.VerboseError.WriteLine(" not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString()); +#endif //continue; } } @@ -74,13 +81,17 @@ namespace RomCheater.PluginFramework.Cor { if (!((uint)ex.ErrorCode == 0x80004005)) { + #if !DISALLOW_VERBOSE_LOGGING logger.VerboseError.WriteLine(" not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString()); +#endif } //continue; } catch (Exception ex) { + #if !DISALLOW_VERBOSE_LOGGING logger.VerboseError.WriteLine(" not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString()); +#endif //continue; } } @@ -88,7 +99,7 @@ namespace RomCheater.PluginFramework.Cor Predicate predicate = new Predicate(IsNotValidProcess); proc_list.RemoveAll(predicate); ValidProcessesForPlugin = proc_list; - logger.SetLoggingFlags(flags); // reset flags + //logger.SetLoggingFlags(flags); // reset flags } protected abstract bool IsNotValidProcess(ProcContainer p);