/[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/05/10 12:16:41	110
+++ trunk/RomCheater/RomCheaterConfigDialog.cs	2012/05/10 13:55:44	111
@@ -78,8 +78,8 @@
         private void load_loggerflags()
         {
             logger.Debug.WriteLine("Loading logger flags...");
-            loggerflags logflags = (loggerflags)Logging.Properties.Settings.Default.LoggingFlags;
-            foreach (loggerflags flags in Enum.GetValues(typeof(loggerflags)))
+            loggerflags logflags = Logging.Properties.Settings.Default.LoggingFlags;
+            foreach (loggerflags flags in loggerflags.GetValues())
             {
                 if (flags == loggerflags.ALL ||
                     flags == loggerflags.NONE ||
@@ -87,7 +87,7 @@
                     continue;
 
                 string name = flags.ToString();
-                int value = (int)flags;
+                ushort value = (ushort)flags;
 
                 CheckBox chkloggerflags = new CheckBox();
                 chkloggerflags.Font = this.Font;
@@ -102,7 +102,7 @@
                 grpLoggingFlags_flow.Controls.Add(chkloggerflags);
                 logger.Debug.WriteLine("\tAdding logger flag: {0} value: 0x{1:x4}", name, value);
 
-                if (logflags.HasFlag((loggerflags)value))
+                if (logflags.HasFlag(value))
                 {
                     chkloggerflags.Checked = true;
                     logger.Debug.WriteLine("\tTurning on logger flag: {0} value: 0x{1:x4}", name, value);
@@ -148,11 +148,11 @@
             foreach (CheckBox cb in grpLoggingFlags_flow.Controls)
             {
                 if (!cb.Checked) continue;
-                int value = Convert.ToInt32(cb.Tag);                
-                logflags = logflags | (loggerflags)value;
+                ushort value = Convert.ToUInt16(cb.Tag);
+                logflags = (ushort)(logflags | value);
                 logger.Debug.WriteLine("\tAdding flag: {0} value: 0x{1:x4} LoggingFlags=0x{2:x4}", cb.Text, value, (int)logflags);                
             }
-            Logging.Properties.Settings.Default.LoggingFlags = (int)logflags;
+            Logging.Properties.Settings.Default.LoggingFlags = (ushort)logflags;
             logger.Debug.WriteLine("Saved Logger flags.");
         }
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22