ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Main.cs
Revision: 87
Committed: Wed May 9 19:51:42 2012 UTC (11 years, 6 months ago) by william
File size: 3044 byte(s)
Log Message:
+ add support for loading and saving config plugins

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