ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Main.cs
Revision: 96
Committed: Wed May 9 22:42:57 2012 UTC (11 years, 9 months ago) by william
File size: 3395 byte(s)
Log Message:

File Contents

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