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

Contents of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 104 - (show annotations) (download)
Thu May 10 10:10:55 2012 UTC (8 years, 4 months ago) by william
File size: 4309 byte(s)
+ add support to expand and collapse (back to original position) log window

1 #define FORCE_ALL_LOGGING_FLAGS // when defined will force logging flags to ALL
2 using System;
3 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 using RomCheater.Logging;
11 using RomCheater.Properties;
12 using RomCheater.UserSettingsSupport;
13 using RomCheater.PluginFramework.Core;
14 using System.Diagnostics;
15 using RomCheater.PluginFramework.Interfaces;
16
17 namespace RomCheater
18 {
19 public partial class Main : Form
20 {
21 private bool log_window_expanded = false;
22 private double log_window_splitter_default_position = 1.4045;
23 PluginLoader loader = null;
24 IConfigPlugin ConfigPlugin = null;
25 IInputPlugin InputPlugin = null;
26 IWindowPlugin WindowPlugin = null;
27 static Main()
28 {
29 SettingSubscriber.AddSubscriber(Settings.Default);
30 }
31 private const string t = "RomCheater";
32 #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 public Main()
43 {
44 InitializeComponent();
45 load_loggerflags();
46 LoggerInstance = logwriter;
47 LoggerInstance.CreateNewLog(false);
48 logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", (ushort)logger.GetLoggingFlags(), logger.GetLoggingFlags().ToString());
49 load_plugins();
50 }
51
52 private void load_loggerflags()
53 {
54 logger.SetLoggingFlags((loggerflags)Logging.Properties.Settings.Default.LoggingFlags);
55 #if FORCE_ALL_LOGGING_FLAGS
56 logger.SetLoggingFlags(loggerflags.ALL);
57 #endif
58 }
59 private void load_plugins()
60 {
61 loader = new PluginLoader();
62 loader.LoadPlugins();
63
64 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 private void mnuItemExit_Click(object sender, EventArgs e)
77 {
78 this.Close();
79 }
80
81 private void btnCopyLogToClipboard_Click(object sender, EventArgs e)
82 {
83
84 }
85
86 private void Main_Load(object sender, EventArgs e)
87 {
88 }
89
90 private void mnuItemConfig_Click(object sender, EventArgs e)
91 {
92 RomCheaterConfigDialog dlg = new RomCheaterConfigDialog(loader);
93 dlg.ShowDialog();
94 // reload plugins
95 load_plugins();
96 }
97
98 private void mnuItemOpenProcess_Click(object sender, EventArgs e)
99 {
100 //List<Process> procs = ConfigPlugin.ValidProcessesForPlugin;
101 PIDSelector selector = new PIDSelector(ConfigPlugin);
102 selector.ShowDialog();
103 }
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 }
123 }

  ViewVC Help
Powered by ViewVC 1.1.22