ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Main.cs
Revision: 99
Committed: Wed May 9 23:23:38 2012 UTC (11 years ago) by william
File size: 3511 byte(s)
Log Message:
+ add logging options:
* VERBOSE_DEBUG and VERBOSE_ERROR : for debug and error messages that are very 'chatty'

File Contents

# Content
1 #define FORCE_ALL_LOGGING_FLAGS // when defined will force logging flags to ALL
2 using System;
3 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 using RomCheater.Logging;
11 using RomCheater.Properties;
12 using RomCheater.UserSettingsSupport;
13 using RomCheater.PluginFramework.Core;
14 using System.Diagnostics;
15 using RomCheater.PluginFramework.Interfaces;
16
17 namespace RomCheater
18 {
19 public partial class Main : Form
20 {
21 PluginLoader loader = null;
22 IConfigPlugin ConfigPlugin = null;
23 IInputPlugin InputPlugin = null;
24 IWindowPlugin WindowPlugin = null;
25 static Main()
26 {
27 SettingSubscriber.AddSubscriber(Settings.Default);
28 }
29 private const string t = "RomCheater";
30 #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 public Main()
41 {
42 InitializeComponent();
43 load_loggerflags();
44 LoggerInstance = logwriter;
45 LoggerInstance.CreateNewLog(false);
46 logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", (ushort)logger.GetLoggingFlags(), logger.GetLoggingFlags().ToString());
47 load_plugins();
48 }
49
50 private void load_loggerflags()
51 {
52 logger.SetLoggingFlags((loggerflags)Logging.Properties.Settings.Default.LoggingFlags);
53 #if FORCE_ALL_LOGGING_FLAGS
54 logger.SetLoggingFlags(loggerflags.ALL);
55 #endif
56 }
57 private void load_plugins()
58 {
59 loader = new PluginLoader();
60 loader.LoadPlugins();
61
62 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 private void mnuItemExit_Click(object sender, EventArgs e)
75 {
76 this.Close();
77 }
78
79 private void btnCopyLogToClipboard_Click(object sender, EventArgs e)
80 {
81
82 }
83
84 private void Main_Load(object sender, EventArgs e)
85 {
86 }
87
88 private void mnuItemConfig_Click(object sender, EventArgs e)
89 {
90 RomCheaterConfigDialog dlg = new RomCheaterConfigDialog(loader);
91 dlg.ShowDialog();
92 // reload plugins
93 load_plugins();
94 }
95
96 private void mnuItemOpenProcess_Click(object sender, EventArgs e)
97 {
98 //List<Process> procs = ConfigPlugin.ValidProcessesForPlugin;
99 PIDSelector selector = new PIDSelector(ConfigPlugin);
100 selector.ShowDialog();
101 }
102 }
103 }