/[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 812 by william, Tue Apr 15 14:52:10 2014 UTC revision 814 by william, Tue Apr 15 15:58:50 2014 UTC
# Line 1  Line 1 
1  #region Logging Defines  //#region Logging Defines
2  // include this any class or method that required logging, and comment-out what is not needed  //// include this any class or method that required logging, and comment-out what is not needed
3    
4  #region Enabled logging levels  //#region Enabled logging levels
5  #define LOGGING_ENABLE_INFO  //#define LOGGING_ENABLE_INFO
6  #define LOGGING_ENABLE_WARN  //#define LOGGING_ENABLE_WARN
7  #define LOGGING_ENABLE_DEBUG  //#define LOGGING_ENABLE_DEBUG
8  #define LOGGING_ENABLE_VERBOSEDEBUG  //#define LOGGING_ENABLE_VERBOSEDEBUG
9  #define LOGGING_ENABLE_ERROR  //#define LOGGING_ENABLE_ERROR
10  #define LOGGING_ENABLE_VERBOSEERROR  //#define LOGGING_ENABLE_VERBOSEERROR
11  #define LOGGING_ENABLE_PROFILER  //#define LOGGING_ENABLE_PROFILER
12  #endregion  //#endregion
13  #endregion  //#endregion
14  //#define DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST //when defined, will not log verbose debug messages (without changeing logging flags)  //#define DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST //when defined, will not log verbose debug messages (without changeing logging flags)
15  using System;  using System;
16  using System.Collections.Generic;  using System.Collections.Generic;
# Line 114  namespace RomCheater Line 114  namespace RomCheater
114    
115          private void load_loggerflags()          private void load_loggerflags()
116          {          {
117              gLog.Info.WriteLine("  Loading logger flags...");              //gLog.Info.WriteLine("  Loading logger flags...");
118              object o_flags = LoggingettingsSubscriber.GetValue("LoggingFlags");              //object o_flags = LoggingettingsSubscriber.GetValue("LoggingFlags");
119              loggerflags logflags = (ushort)Convert.ChangeType(o_flags, typeof(ushort));              //loggerflags logflags = (ushort)Convert.ChangeType(o_flags, typeof(ushort));
120              if (logflags != logger.GetLoggingFlags())              //if (logflags != logger.GetLoggingFlags())
121              {              //{
122                  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)
123              }              //}
124  #if DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST  #if DISABLE_VERBOSE_DEBUG_MESSAGES_FOR_SPEED_BOOST
125              lFlags = logflags;              //lFlags = logflags;
126              ushort pflags = lFlags.Value;              //ushort pflags = lFlags.Value;
127              if (lFlags.HasFlag(loggerflags.VERBOSE_DEBUG))              //if (lFlags.HasFlag(loggerflags.VERBOSE_DEBUG))
128              {              //{
129                  pflags = lFlags.Value;              //    pflags = lFlags.Value;
130                  pflags = (ushort)(lFlags.Value & ~loggerflags.VERBOSE_DEBUG.Value);              //    pflags = (ushort)(lFlags.Value & ~loggerflags.VERBOSE_DEBUG.Value);
131                  logger.SetLoggingFlags(pflags);              //    logger.SetLoggingFlags(pflags);
132              }              //}
133  #endif  #endif
134              var logger_flags = loggerflags.GetValues();              //var logger_flags = loggerflags.GetValues();
135    
136              foreach (loggerflags flags in logger_flags)              //foreach (loggerflags flags in logger_flags)
137              {              //{
138                  if (flags == loggerflags.ALL ||              //    if (flags == loggerflags.ALL ||
139                      flags == loggerflags.NONE ||              //        flags == loggerflags.NONE ||
140                      flags == loggerflags.DEFAULT)              //        flags == loggerflags.DEFAULT)
141                      continue;              //        continue;
142                //    string name = flags.Name;
143                  string name = flags.Name;              //    ushort value = (ushort)flags;
144                  ushort value = (ushort)flags;              //    CheckBox chkloggerflags = new CheckBox();
145                //    chkloggerflags.Font = this.Font;
146                  CheckBox chkloggerflags = new CheckBox();              //    chkloggerflags.Name = name;
147                  chkloggerflags.Font = this.Font;              //    chkloggerflags.Text = name;
148                  chkloggerflags.Name = name;              //    chkloggerflags.Tag = value;
149                  chkloggerflags.Text = name;              //    Graphics g = chkloggerflags.CreateGraphics();
150                  chkloggerflags.Tag = value;              //    Size size = g.MeasureString(chkloggerflags.Text, chkloggerflags.Font).ToSize();
151                  Graphics g = chkloggerflags.CreateGraphics();              //    chkloggerflags.Width = size.Width + 25;
152                //    grpLoggingFlags_flow.Controls.Add(chkloggerflags);
153                  Size size = g.MeasureString(chkloggerflags.Text, chkloggerflags.Font).ToSize();              //    logger.VerboseDebug.WriteLine("\tAdding logger flag: {0} value: 0x{1:x4}", name, value);
154                  chkloggerflags.Width = size.Width + 25;              //    if (logflags.HasFlag(value))
155                //    {
156                  grpLoggingFlags_flow.Controls.Add(chkloggerflags);              //        chkloggerflags.Checked = true;
157                  logger.VerboseDebug.WriteLine("\tAdding logger flag: {0} value: 0x{1:x4}", name, value);              //        logger.VerboseDebug.WriteLine("\tTurning on logger flag: {0} value: 0x{1:x4}", name, value);
158                  if (logflags.HasFlag(value))              //    }
159                  {              //}
                     chkloggerflags.Checked = true;  
                     logger.VerboseDebug.WriteLine("\tTurning on logger flag: {0} value: 0x{1:x4}", name, value);  
                 }  
             }  
160              //grpLoggingFlags.AutoSize = true;              //grpLoggingFlags.AutoSize = true;
161              //grpLoggingFlags.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;              //grpLoggingFlags.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
162              gLog.Info.WriteLine("  Loaded logger flags.");              //gLog.Info.WriteLine("  Loaded logger flags.");
163          }          }
164          private void btnSave_Click(object sender, EventArgs e)          private void btnSave_Click(object sender, EventArgs e)
165          {          {
# Line 198  namespace RomCheater Line 194  namespace RomCheater
194          }          }
195          private void SaveLoggingFlags()          private void SaveLoggingFlags()
196          {          {
197              gLog.Debug.WriteLine("Saving Logger flags...");              //gLog.Debug.WriteLine("Saving Logger flags...");
198              ushort logflags = loggerflags.NONE;              //ushort logflags = loggerflags.NONE;
199              foreach (CheckBox cb in grpLoggingFlags_flow.Controls)              //foreach (CheckBox cb in grpLoggingFlags_flow.Controls)
200              {              //{
201                  if (!cb.Checked) continue;              //    if (!cb.Checked) continue;
202                  ushort value = Convert.ToUInt16(cb.Tag);              //    ushort value = Convert.ToUInt16(cb.Tag);
203                  logflags = (ushort)(logflags | value);              //    logflags = (ushort)(logflags | value);
204                  gLog.Verbose.Debug.WriteLine("\tAdding flag: {0} value: 0x{1:x4} LoggingFlags=0x{2:x4}", cb.Text, value, (int)logflags);                              //    gLog.Verbose.Debug.WriteLine("\tAdding flag: {0} value: 0x{1:x4} LoggingFlags=0x{2:x4}", cb.Text, value, (int)logflags);                
205              }              //}
206    
207              LoggingettingsSubscriber.SetValue("LoggingFlags", (ushort)logflags);              //LoggingettingsSubscriber.SetValue("LoggingFlags", (ushort)logflags);
208              gLog.Debug.WriteLine("Saved Logger flags.");              //gLog.Debug.WriteLine("Saved Logger flags.");
209          }          }
210    
211          private void RomCheaterConfigDialog_FormClosing(object sender, FormClosingEventArgs e)          private void RomCheaterConfigDialog_FormClosing(object sender, FormClosingEventArgs e)

Legend:
Removed from v.812  
changed lines
  Added in v.814

  ViewVC Help
Powered by ViewVC 1.1.22