/[RomCheater]/trunk/RomCheater/RomCheaterConfigDialog.cs
ViewVC logotype

Diff of /trunk/RomCheater/RomCheaterConfigDialog.cs

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

--- trunk/RomCheater/RomCheaterConfigDialog.cs	2012/06/03 19:51:54	266
+++ trunk/RomCheater/RomCheaterConfigDialog.cs	2012/06/03 20:57:44	270
@@ -1,4 +1,5 @@
-´╗┐using System;
+´╗┐#define DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST //when defined, will not log verbose debug messages (without changeing logging flags)
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
@@ -14,12 +15,25 @@
 {
     public partial class RomCheaterConfigDialog : Form
     {
+#if DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST
+        private loggerflags lFlags;
+#endif
+
         private PluginLoader loader = null;
         public RomCheaterConfigDialog()
         {
             InitializeComponent();
+            //lFlags = logger.GetLoggingFlags();
+            //ushort flags = lFlags.Value;
+            //if (lFlags.HasFlag(loggerflags.VERBOSE_DEBUG))
+            //{
+            //    flags = lFlags.Value;
+            //    flags = (ushort)(lFlags.Value & ~loggerflags.VERBOSE_DEBUG.Value);
+            //    logger.SetLoggingFlags(flags);                
+            //}
         }
-        public RomCheaterConfigDialog(PluginLoader loader) : this()
+        public RomCheaterConfigDialog(PluginLoader loader)
+            : this()
         {
             this.loader = loader;
         }
@@ -77,14 +91,23 @@
 
         private void load_loggerflags()
         {
-            logger.VerboseDebug.WriteLine("Loading logger flags...");
+            logger.Info.WriteLine("  Loading logger flags...");
             loggerflags logflags = Logging.Properties.Settings.Default.LoggingFlags;
 
             if (logflags != logger.GetLoggingFlags())
             {
                 logflags = logger.GetLoggingFlags(); // we apparently have forced the logging flags (possible for testing)
             }
-
+#if DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST
+            lFlags = logflags;
+            ushort pflags = lFlags.Value;
+            if (lFlags.HasFlag(loggerflags.VERBOSE_DEBUG))
+            {
+                pflags = lFlags.Value;
+                pflags = (ushort)(lFlags.Value & ~loggerflags.VERBOSE_DEBUG.Value);
+                logger.SetLoggingFlags(pflags);
+            }
+#endif
             foreach (loggerflags flags in loggerflags.GetValues())
             {
                 if (flags == loggerflags.ALL ||
@@ -107,7 +130,6 @@
 
                 grpLoggingFlags_flow.Controls.Add(chkloggerflags);
                 logger.VerboseDebug.WriteLine("\tAdding logger flag: {0} value: 0x{1:x4}", name, value);
-
                 if (logflags.HasFlag(value))
                 {
                     chkloggerflags.Checked = true;
@@ -116,7 +138,7 @@
             }
             //grpLoggingFlags.AutoSize = true;
             //grpLoggingFlags.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
-            logger.Debug.WriteLine("Loaded logger flags.");
+            logger.Info.WriteLine("  Loaded logger flags.");
         }
         private void btnSave_Click(object sender, EventArgs e)
         {
@@ -140,10 +162,8 @@
         {
             logger.VerboseDebug.WriteLine("    Setting LastConfigPlugin to {0}", comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString());
             RomCheater.Properties.Settings.Default.LastConfigPlugin = comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString();
-
             logger.VerboseDebug.WriteLine("    Setting LastInputPlugin to {0}", comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString());
             RomCheater.Properties.Settings.Default.LastInputPlugin = comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString();
-
             logger.VerboseDebug.WriteLine("    Setting LastWindowPlugin to {0}", comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString());
             RomCheater.Properties.Settings.Default.LastWindowPlugin = comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString();
         }
@@ -161,5 +181,17 @@
             Logging.Properties.Settings.Default.LoggingFlags = (ushort)logflags;
             logger.Debug.WriteLine("Saved Logger flags.");
         }
+
+        private void RomCheaterConfigDialog_FormClosing(object sender, FormClosingEventArgs e)
+        {
+
+        }
+
+        private void RomCheaterConfigDialog_FormClosed(object sender, FormClosedEventArgs e)
+        {
+#if DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST
+            logger.SetLoggingFlags(lFlags);
+#endif
+        }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22