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{1:x4} ({0})", (loggerflags)Logging.Properties.Settings.Default.LoggingFlags, Logging.Properties.Settings.Default.LoggingFlags); |
46 |
load_plugins(); |
47 |
} |
48 |
|
49 |
private void load_loggerflags() |
50 |
{ |
51 |
logger.SetLoggingFlags((loggerflags)Logging.Properties.Settings.Default.LoggingFlags); |
52 |
|
53 |
} |
54 |
private void load_plugins() |
55 |
{ |
56 |
loader = new PluginLoader(); |
57 |
loader.LoadPlugins(); |
58 |
|
59 |
ConfigPlugin = loader.GetConfigPlugin(RomCheater.Properties.Settings.Default.LastConfigPlugin); |
60 |
if (ConfigPlugin != null) |
61 |
logger.Info.WriteLine("Loaded Config Plugin: {0}", ConfigPlugin.ToString()); |
62 |
InputPlugin = loader.GetInputPlugin(RomCheater.Properties.Settings.Default.LastInputPlugin); |
63 |
if (InputPlugin != null) |
64 |
logger.Info.WriteLine("Loaded Input Plugin: {0}", InputPlugin.ToString()); |
65 |
WindowPlugin = loader.GetWindowPlugin(RomCheater.Properties.Settings.Default.LastWindowPlugin); |
66 |
if (WindowPlugin != null) |
67 |
logger.Info.WriteLine("Loaded Window Plugin: {0}", WindowPlugin.ToString()); |
68 |
|
69 |
} |
70 |
|
71 |
private void mnuItemExit_Click(object sender, EventArgs e) |
72 |
{ |
73 |
this.Close(); |
74 |
} |
75 |
|
76 |
private void btnCopyLogToClipboard_Click(object sender, EventArgs e) |
77 |
{ |
78 |
|
79 |
} |
80 |
|
81 |
private void Main_Load(object sender, EventArgs e) |
82 |
{ |
83 |
} |
84 |
|
85 |
private void mnuItemConfig_Click(object sender, EventArgs e) |
86 |
{ |
87 |
RomCheaterConfigDialog dlg = new RomCheaterConfigDialog(loader); |
88 |
dlg.ShowDialog(); |
89 |
// reload plugins |
90 |
load_plugins(); |
91 |
} |
92 |
|
93 |
private void mnuItemOpenProcess_Click(object sender, EventArgs e) |
94 |
{ |
95 |
//List<Process> procs = ConfigPlugin.ValidProcessesForPlugin; |
96 |
PIDSelector selector = new PIDSelector(ConfigPlugin); |
97 |
selector.ShowDialog(); |
98 |
} |
99 |
} |
100 |
} |