/[RomCheater]/trunk/RomCheater/Main.cs
ViewVC logotype

Annotation of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 112 - (hide annotations) (download)
Thu May 10 14:01:31 2012 UTC (9 years, 6 months ago) by william
File size: 4288 byte(s)
+ correct getting name and value from loggingflags
+ don't autosize loggingflags config control

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

  ViewVC Help
Powered by ViewVC 1.1.22