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, 9 months ago) by william
File size: 3350 byte(s)
Log Message:
get logging flags directly from logger class

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 97 logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", (ushort)logger.GetLoggingFlags(), logger.GetLoggingFlags().ToString());
46 william 87 load_plugins();
47 william 5 }
48 william 14
49 william 83 private void load_loggerflags()
50     {
51 william 97 logger.SetLoggingFlags((loggerflags)Logging.Properties.Settings.Default.LoggingFlags);
52 william 83 }
53 william 87 private void load_plugins()
54     {
55     loader = new PluginLoader();
56     loader.LoadPlugins();
57 william 83
58 william 87 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 william 14 private void mnuItemExit_Click(object sender, EventArgs e)
71     {
72     this.Close();
73     }
74 william 16
75     private void btnCopyLogToClipboard_Click(object sender, EventArgs e)
76     {
77    
78     }
79 william 17
80     private void Main_Load(object sender, EventArgs e)
81 william 87 {
82 william 17 }
83 william 63
84     private void mnuItemConfig_Click(object sender, EventArgs e)
85     {
86 william 86 RomCheaterConfigDialog dlg = new RomCheaterConfigDialog(loader);
87 william 63 dlg.ShowDialog();
88 william 92 // reload plugins
89     load_plugins();
90 william 63 }
91 william 69
92     private void mnuItemOpenProcess_Click(object sender, EventArgs e)
93     {
94 william 88 //List<Process> procs = ConfigPlugin.ValidProcessesForPlugin;
95     PIDSelector selector = new PIDSelector(ConfigPlugin);
96     selector.ShowDialog();
97 william 69 }
98 william 5 }
99     }