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

Diff of /trunk/RomCheater/Main.cs

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

revision 813 by william, Tue Apr 15 14:58:01 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 FORCE_ALL_LOGGING_FLAGS // when defined will force logging flags to ALL  //#define FORCE_ALL_LOGGING_FLAGS // when defined will force logging flags to ALL
15  #define SHOW_DEBUG_MENU // when defined will show the debug menu or else it will be hidden  #define SHOW_DEBUG_MENU // when defined will show the debug menu or else it will be hidden
16  using System;  using System;
# Line 40  namespace RomCheater Line 40  namespace RomCheater
40  {  {
41      public partial class Main : Form      public partial class Main : Form
42      {      {
43            private ushort Logger_flags = 0;
44            private LogLevel logging_level = LogLevel.kLogLevel_All;
45          const string DockPanelConfig = "RomCheater-DockPanel.conf";          const string DockPanelConfig = "RomCheater-DockPanel.conf";
46          private SettingSubscriber SettingsSubscriber;          private SettingSubscriber SettingsSubscriber;
47          private bool m_bSaveLayout = true;          private bool m_bSaveLayout = true;
# Line 71  namespace RomCheater Line 73  namespace RomCheater
73          //static Main() { SettingSubscriber.AddSubscriber(new Main(), Settings.Default); }          //static Main() { SettingSubscriber.AddSubscriber(new Main(), Settings.Default); }
74          //private const string t = "RomCheater";          //private const string t = "RomCheater";
75          #region LogWriterSupport          #region LogWriterSupport
76          //static LogWriter _LoggerInstance;          static LogWriter _LoggerInstance;
77          //static LogWriter LoggerInstance          static LogWriter LoggerInstance
78          //{          {
79          //    get { return _LoggerInstance; }              get { return _LoggerInstance; }
80          //    set { _LoggerInstance = value; }              set { _LoggerInstance = value; }
81          //}          }
82          #endregion          #endregion
83    
84    
# Line 192  namespace RomCheater Line 194  namespace RomCheater
194          public void SetupDocks()          public void SetupDocks()
195          {          {
196              m_LogWindow = new FloatingLogWindow();              m_LogWindow = new FloatingLogWindow();
197                LoggerInstance = m_LogWindow.Logwriter;
198              m_AboutBox = new FloatingAboutBox();              m_AboutBox = new FloatingAboutBox();
199              m_RamDump = new FloatingRamDumperDialog();              m_RamDump = new FloatingRamDumperDialog();
200              m_PIDSelector = new FloatingPIDSelector();              m_PIDSelector = new FloatingPIDSelector();
# Line 343  namespace RomCheater Line 346  namespace RomCheater
346          public void ShowLogWindow()          public void ShowLogWindow()
347          {          {
348              if (m_LogWindow == null || m_LogWindow.IsDisposed) { m_LogWindow = new FloatingLogWindow(); }              if (m_LogWindow == null || m_LogWindow.IsDisposed) { m_LogWindow = new FloatingLogWindow(); }
349              //LoggerInstance = m_LogWindow.Logwriter;              LoggerInstance = m_LogWindow.Logwriter;
350              //LoggerInstance.CreateNewLog(false);              //LoggerInstance.CreateNewLog(false);
351              m_LogWindow.Show(dockPanel, DockState.DockBottom);                    m_LogWindow.Show(dockPanel, DockState.DockBottom);      
352          }          }
# Line 441  namespace RomCheater Line 444  namespace RomCheater
444              mnuDebug.Visible = false;              mnuDebug.Visible = false;
445  #endif  #endif
446              SettingsSubscriber = new SettingSubscriber();              SettingsSubscriber = new SettingSubscriber();
447              SettingsSubscriber.AddSubscriber(this, Settings.Default);              SettingsSubscriber.AddSubscriber(this, Settings.Default);            
             load_loggerflags();  
448              SetupDocks();              SetupDocks();
449              //LoggerInstance = m_LogWindow.Logwriter;              LoggerInstance = m_LogWindow.Logwriter;
450              //LoggerInstance.CreateNewLog(false);              load_loggerflags();
451              //logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name);              load_plugins();      
             load_plugins();  
             //if (no_console_redirect)  
             //    LoggerInstance.RedirectConsoleOutput = false;            
452          }          }
453          private void load_loggerflags()          private void load_loggerflags()
454          {          {
455              //logger.SetLoggingFlags(Logging.Properties.Settings.Default.LoggingFlags);  #warning LoggingFlags setting needs to be changed to Uint32 instead of Uint16
456                logging_level = (LogLevel)(Logging.Properties.Settings.Default.LoggingFlags);            
457               logging_level = new LoggingFlagsConverter(Logging.Properties.Settings.Default.LoggingFlags).ConvertFlags();
458  #if FORCE_ALL_LOGGING_FLAGS  #if FORCE_ALL_LOGGING_FLAGS
459              //logger.SetLoggingFlags(loggerflags.ALL);              logging_level = LogLevel.kLogLevel_All;
460  #endif  #endif            
461               gLog.CreateLog(LoggingConstants.AppFullLogPath, true, logging_level, new EventHandler<LoggerOnFlushEventArgs>(Log_OnFlush), LoggerInstance.Log);
462            }
463    
464            private void Log_OnFlush(object sender, LoggerOnFlushEventArgs e)
465            {          
466          }          }
467          private void load_plugins() { load_plugins(false); }          private void load_plugins() { load_plugins(false); }
468          private void load_plugins_silent() { load_plugins(true); }          private void load_plugins_silent() { load_plugins(true); }

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

  ViewVC Help
Powered by ViewVC 1.1.22