ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Main.cs
Revision: 97
Committed: Wed May 9 22:48:59 2012 UTC (11 years, 6 months ago) by william
File size: 3350 byte(s)
Log Message:
get logging flags directly from logger class

File Contents

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