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

Diff of /trunk/RomCheater/RomCheaterConfigDialog.cs

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

revision 266 by william, Sun Jun 3 19:51:54 2012 UTC revision 414 by william, Fri Jun 22 08:21:18 2012 UTC
# Line 1  Line 1 
1  ´╗┐using System;  ´╗┐#region Logging Defines
2    // include this any class or method that required logging, and comment-out what is not needed
3    #define LOGGING_ENABLED
4    #region Enabled logging levels
5    #define LOGGING_ENABLE_INFO
6    #define LOGGING_ENABLE_WARN
7    #define LOGGING_ENABLE_DEBUG
8    #define LOGGING_ENABLE_VERBOSEDEBUG
9    #define LOGGING_ENABLE_ERROR
10    #define LOGGING_ENABLE_VERBOSEERROR
11    #define LOGGING_ENABLE_PROFILER
12    #endregion
13    #endregion
14    //#define DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST //when defined, will not log verbose debug messages (without changeing logging flags)
15    using System;
16  using System.Collections.Generic;  using System.Collections.Generic;
17  using System.ComponentModel;  using System.ComponentModel;
18  using System.Data;  using System.Data;
# Line 14  namespace RomCheater Line 28  namespace RomCheater
28  {  {
29      public partial class RomCheaterConfigDialog : Form      public partial class RomCheaterConfigDialog : Form
30      {      {
31    #if DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST
32            private loggerflags lFlags;
33    #endif
34    
35          private PluginLoader loader = null;          private PluginLoader loader = null;
36          public RomCheaterConfigDialog()          public RomCheaterConfigDialog()
37          {          {
38              InitializeComponent();              InitializeComponent();
39                //lFlags = logger.GetLoggingFlags();
40                //ushort flags = lFlags.Value;
41                //if (lFlags.HasFlag(loggerflags.VERBOSE_DEBUG))
42                //{
43                //    flags = lFlags.Value;
44                //    flags = (ushort)(lFlags.Value & ~loggerflags.VERBOSE_DEBUG.Value);
45                //    logger.SetLoggingFlags(flags);                
46                //}
47          }          }
48          public RomCheaterConfigDialog(PluginLoader loader) : this()          public RomCheaterConfigDialog(PluginLoader loader)
49                : this()
50          {          {
51              this.loader = loader;              this.loader = loader;
52          }          }
# Line 77  namespace RomCheater Line 104  namespace RomCheater
104    
105          private void load_loggerflags()          private void load_loggerflags()
106          {          {
107              logger.VerboseDebug.WriteLine("Loading logger flags...");              logger.Info.WriteLine("  Loading logger flags...");
108              loggerflags logflags = Logging.Properties.Settings.Default.LoggingFlags;              loggerflags logflags = Logging.Properties.Settings.Default.LoggingFlags;
109    
110              if (logflags != logger.GetLoggingFlags())              if (logflags != logger.GetLoggingFlags())
111              {              {
112                  logflags = logger.GetLoggingFlags(); // we apparently have forced the logging flags (possible for testing)                  logflags = logger.GetLoggingFlags(); // we apparently have forced the logging flags (possible for testing)
113              }              }
114    #if DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST
115                lFlags = logflags;
116                ushort pflags = lFlags.Value;
117                if (lFlags.HasFlag(loggerflags.VERBOSE_DEBUG))
118                {
119                    pflags = lFlags.Value;
120                    pflags = (ushort)(lFlags.Value & ~loggerflags.VERBOSE_DEBUG.Value);
121                    logger.SetLoggingFlags(pflags);
122                }
123    #endif
124              foreach (loggerflags flags in loggerflags.GetValues())              foreach (loggerflags flags in loggerflags.GetValues())
125              {              {
126                  if (flags == loggerflags.ALL ||                  if (flags == loggerflags.ALL ||
# Line 107  namespace RomCheater Line 143  namespace RomCheater
143    
144                  grpLoggingFlags_flow.Controls.Add(chkloggerflags);                  grpLoggingFlags_flow.Controls.Add(chkloggerflags);
145                  logger.VerboseDebug.WriteLine("\tAdding logger flag: {0} value: 0x{1:x4}", name, value);                  logger.VerboseDebug.WriteLine("\tAdding logger flag: {0} value: 0x{1:x4}", name, value);
   
146                  if (logflags.HasFlag(value))                  if (logflags.HasFlag(value))
147                  {                  {
148                      chkloggerflags.Checked = true;                      chkloggerflags.Checked = true;
# Line 116  namespace RomCheater Line 151  namespace RomCheater
151              }              }
152              //grpLoggingFlags.AutoSize = true;              //grpLoggingFlags.AutoSize = true;
153              //grpLoggingFlags.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;              //grpLoggingFlags.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
154              logger.Debug.WriteLine("Loaded logger flags.");              logger.Info.WriteLine("  Loaded logger flags.");
155          }          }
156          private void btnSave_Click(object sender, EventArgs e)          private void btnSave_Click(object sender, EventArgs e)
157          {          {
# Line 140  namespace RomCheater Line 175  namespace RomCheater
175          {          {
176              logger.VerboseDebug.WriteLine("    Setting LastConfigPlugin to {0}", comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString());              logger.VerboseDebug.WriteLine("    Setting LastConfigPlugin to {0}", comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString());
177              RomCheater.Properties.Settings.Default.LastConfigPlugin = comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString();              RomCheater.Properties.Settings.Default.LastConfigPlugin = comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString();
   
178              logger.VerboseDebug.WriteLine("    Setting LastInputPlugin to {0}", comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString());              logger.VerboseDebug.WriteLine("    Setting LastInputPlugin to {0}", comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString());
179              RomCheater.Properties.Settings.Default.LastInputPlugin = comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString();              RomCheater.Properties.Settings.Default.LastInputPlugin = comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString();
   
180              logger.VerboseDebug.WriteLine("    Setting LastWindowPlugin to {0}", comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString());              logger.VerboseDebug.WriteLine("    Setting LastWindowPlugin to {0}", comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString());
181              RomCheater.Properties.Settings.Default.LastWindowPlugin = comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString();              RomCheater.Properties.Settings.Default.LastWindowPlugin = comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString();
182          }          }
# Line 161  namespace RomCheater Line 194  namespace RomCheater
194              Logging.Properties.Settings.Default.LoggingFlags = (ushort)logflags;              Logging.Properties.Settings.Default.LoggingFlags = (ushort)logflags;
195              logger.Debug.WriteLine("Saved Logger flags.");              logger.Debug.WriteLine("Saved Logger flags.");
196          }          }
197    
198            private void RomCheaterConfigDialog_FormClosing(object sender, FormClosingEventArgs e)
199            {
200    
201            }
202    
203            private void RomCheaterConfigDialog_FormClosed(object sender, FormClosedEventArgs e)
204            {
205    #if DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST
206                logger.SetLoggingFlags(lFlags);
207    #endif
208            }
209      }      }
210  }  }

Legend:
Removed from v.266  
changed lines
  Added in v.414

  ViewVC Help
Powered by ViewVC 1.1.22