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

Annotation of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 99 - (hide annotations) (download)
Wed May 9 23:23:38 2012 UTC (9 years, 5 months ago) by william
File size: 3511 byte(s)
+ add logging options:
* VERBOSE_DEBUG and VERBOSE_ERROR : for debug and error messages that are very 'chatty'

1 william 99 #define FORCE_ALL_LOGGING_FLAGS // when defined will force logging flags to ALL
2     using System;
3 william 5 using System.Collections.Generic;
4     using System.ComponentModel;
5     using System.Data;
6     using System.Drawing;
7     using System.Linq;
8     using System.Text;
9     using System.Windows.Forms;
10 william 17 using RomCheater.Logging;
11 william 34 using RomCheater.Properties;
12     using RomCheater.UserSettingsSupport;
13 william 83 using RomCheater.PluginFramework.Core;
14 william 86 using System.Diagnostics;
15 william 87 using RomCheater.PluginFramework.Interfaces;
16 william 5
17     namespace RomCheater
18     {
19 william 13 public partial class Main : Form
20 william 5 {
21 william 86 PluginLoader loader = null;
22 william 87 IConfigPlugin ConfigPlugin = null;
23     IInputPlugin InputPlugin = null;
24     IWindowPlugin WindowPlugin = null;
25 william 34 static Main()
26     {
27     SettingSubscriber.AddSubscriber(Settings.Default);
28     }
29 william 20 private const string t = "RomCheater";
30 william 17 #region LogWriterSupport
31     static LogWriter _LoggerInstance;
32     static LogWriter LoggerInstance
33     {
34     get { return _LoggerInstance; }
35     set { _LoggerInstance = value; }
36     }
37     #endregion
38    
39    
40 william 13 public Main()
41 william 5 {
42     InitializeComponent();
43 william 83 load_loggerflags();
44 william 17 LoggerInstance = logwriter;
45 william 23 LoggerInstance.CreateNewLog(false);
46 william 97 logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", (ushort)logger.GetLoggingFlags(), logger.GetLoggingFlags().ToString());
47 william 87 load_plugins();
48 william 5 }
49 william 14
50 william 83 private void load_loggerflags()
51     {
52 william 99 logger.SetLoggingFlags((loggerflags)Logging.Properties.Settings.Default.LoggingFlags);
53     #if FORCE_ALL_LOGGING_FLAGS
54     logger.SetLoggingFlags(loggerflags.ALL);
55     #endif
56 william 83 }
57 william 87 private void load_plugins()
58     {
59     loader = new PluginLoader();
60     loader.LoadPlugins();
61 william 83
62 william 87 ConfigPlugin = loader.GetConfigPlugin(RomCheater.Properties.Settings.Default.LastConfigPlugin);
63     if (ConfigPlugin != null)
64     logger.Info.WriteLine("Loaded Config Plugin: {0}", ConfigPlugin.ToString());
65     InputPlugin = loader.GetInputPlugin(RomCheater.Properties.Settings.Default.LastInputPlugin);
66     if (InputPlugin != null)
67     logger.Info.WriteLine("Loaded Input Plugin: {0}", InputPlugin.ToString());
68     WindowPlugin = loader.GetWindowPlugin(RomCheater.Properties.Settings.Default.LastWindowPlugin);
69     if (WindowPlugin != null)
70     logger.Info.WriteLine("Loaded Window Plugin: {0}", WindowPlugin.ToString());
71    
72     }
73    
74 william 14 private void mnuItemExit_Click(object sender, EventArgs e)
75     {
76     this.Close();
77     }
78 william 16
79     private void btnCopyLogToClipboard_Click(object sender, EventArgs e)
80     {
81    
82     }
83 william 17
84     private void Main_Load(object sender, EventArgs e)
85 william 87 {
86 william 17 }
87 william 63
88     private void mnuItemConfig_Click(object sender, EventArgs e)
89     {
90 william 86 RomCheaterConfigDialog dlg = new RomCheaterConfigDialog(loader);
91 william 63 dlg.ShowDialog();
92 william 92 // reload plugins
93     load_plugins();
94 william 63 }
95 william 69
96     private void mnuItemOpenProcess_Click(object sender, EventArgs e)
97     {
98 william 88 //List<Process> procs = ConfigPlugin.ValidProcessesForPlugin;
99     PIDSelector selector = new PIDSelector(ConfigPlugin);
100     selector.ShowDialog();
101 william 69 }
102 william 5 }
103     }

  ViewVC Help
Powered by ViewVC 1.1.22