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

Contents of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 755 - (show annotations) (download)
Thu Jun 20 20:04:53 2013 UTC (7 years, 3 months ago) by william
File size: 28334 byte(s)
* rename DockPanel config files
* use a constant string to set the config filename (so we can update/maintain in one location)

1 #region Logging Defines
2 // include this any class or method that required logging, and comment-out what is not needed
3
4 #region Enabled logging levels
5 #define LOGGING_ENABLE_INFO
6 #define LOGGING_ENABLE_WARN
7 #define LOGGING_ENABLE_DEBUG
8 #define LOGGING_ENABLE_VERBOSEDEBUG
9 #define LOGGING_ENABLE_ERROR
10 #define LOGGING_ENABLE_VERBOSEERROR
11 #define LOGGING_ENABLE_PROFILER
12 #endregion
13 #endregion
14 //#define FORCE_ALL_LOGGING_FLAGS // when defined will force logging flags to ALL
15 #define SHOW_DEBUG_MENU // when defined will show the debug menu or else it will be hidden
16 using System;
17 using System.Collections.Generic;
18 using System.ComponentModel;
19 using System.Data;
20 using System.Drawing;
21 using System.Linq;
22 using System.Text;
23 using System.Windows.Forms;
24 using RomCheater.Logging;
25 using RomCheater.Properties;
26 using RomCheater.UserSettingsSupport;
27 using RomCheater.PluginFramework.Core;
28 using System.Diagnostics;
29
30 using WeifenLuo.WinFormsUI.Docking;
31 using RomCheater.Docking;
32 using System.IO;
33 using Sojaner.MemoryScanner;
34 using RomCheater.PluginFramework.Events;
35 using RomCheater.Serialization;
36 using RomCheater.Core;
37
38 namespace RomCheater
39 {
40 public partial class Main : Form
41 {
42 const string DockPanelConfig = "RomCheater-DockPanel.conf";
43 private SettingSubscriber SettingsSubscriber;
44 private bool m_bSaveLayout = true;
45 private Process SelectedProcess = null;
46 private DeserializeDockContent m_deserializeDockContent;
47 private FloatingLogWindow m_LogWindow = new FloatingLogWindow();
48 private FloatingAboutBox m_AboutBox = new FloatingAboutBox();
49 private FloatingRamDumperDialog m_RamDump = new FloatingRamDumperDialog();
50 private FloatingPIDSelector m_PIDSelector = new FloatingPIDSelector();
51 private FloatingMemoryView m_memoryview = new FloatingMemoryView();
52 private FloatingDataTypeConverter m_typeconverter = new FloatingDataTypeConverter();
53 private FloatingMemorySearcher m_memsearcher = new FloatingMemorySearcher();
54 private FloatingPEViewer m_peviewer = new FloatingPEViewer();
55 private FloatingRVACalculator m_rvacalc = new FloatingRVACalculator();
56
57 private FloatingMemorySectionViewer m_msv = new FloatingMemorySectionViewer();
58
59 private FloatingUserControlDock m_ucd = new FloatingUserControlDock();
60
61 private FloatingWebBrowser m_wb = new FloatingWebBrowser();
62
63 //private bool log_window_expanded = false;
64 //private double log_window_splitter_default_position = 1.4045;
65 PluginLoader loader = null;
66 IConfigPlugin ConfigPlugin = null;
67 IInputPlugin InputPlugin = null;
68 IWindowPlugin WindowPlugin = null;
69 List<IUserControlPlugin> UserControlPlugins = null;
70 //static Main() { SettingSubscriber.AddSubscriber(new Main(), Settings.Default); }
71 //private const string t = "RomCheater";
72 #region LogWriterSupport
73 static LogWriter _LoggerInstance;
74 static LogWriter LoggerInstance
75 {
76 get { return _LoggerInstance; }
77 set { _LoggerInstance = value; }
78 }
79 #endregion
80
81
82 public IWebBrowserProvider WebBrowserProvider
83 {
84 get { return new WebBrowserProvider(m_wb); }
85 }
86
87 private void OnProcessChanged(ProcessChangedEventArgs e)
88 {
89 ConfigPlugin.WebBrowserProvider = this.WebBrowserProvider;
90 if (m_memsearcher.SearchInProgess)
91 {
92 DialogResult result = MessageBox.Show("Do you want to start a new search with the selected process?", "A memory search is currently in progress", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
93 if (result != DialogResult.Yes || result != DialogResult.OK) { return; }
94 m_memsearcher = null; //free memory used by the memory searcher
95 m_memsearcher = new FloatingMemorySearcher();
96 }
97 SelectedProcess = Process.GetProcessById(e.ProcessID);
98 m_RamDump.AcceptedPlugin = this.ConfigPlugin;
99 m_RamDump.AcceptedProcess = SelectedProcess;
100
101 m_peviewer.AcceptedPlugin = this.ConfigPlugin;
102 m_peviewer.AcceptedProcess = SelectedProcess;
103 m_peviewer.OnPEDataUpdated += new BaseEventHandler<PEViewerDataUpdatedEventArgs>(OnPEDataUpdated);
104
105 m_memoryview.AcceptedPlugin = this.ConfigPlugin;
106 m_memoryview.AcceptedProcess = SelectedProcess;
107
108 m_memsearcher.AcceptedPlugin = this.ConfigPlugin;
109 m_memsearcher.AcceptedProcess = SelectedProcess;
110 m_memsearcher.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion);
111
112 m_msv.AcceptedPlugin = this.ConfigPlugin;
113 m_msv.AcceptedProcess = SelectedProcess;
114 m_msv.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion);
115
116
117 AcceptedProcessAndConfig iapc = new AcceptedProcessAndConfig(this.ConfigPlugin, SelectedProcess);
118
119 this.ConfigPlugin.SetAcceptedProcessAndConfig(iapc);
120 this.WindowPlugin.SetAcceptedProcessAndConfig(iapc);
121 this.InputPlugin.SetAcceptedProcessAndConfig(iapc);
122 for (int i = 0; i < UserControlPlugins.Count; i++)
123 {
124 UserControlPlugins[i].SetAcceptedProcessAndConfig(iapc);
125 }
126 }
127
128 void OnPEDataUpdated(PEViewerDataUpdatedEventArgs e)
129 {
130 m_memoryview.SetPEViewerData(e.peData);
131 m_memsearcher.SetPEViewerData(e.peData);
132 m_rvacalc.SetPEViewerData(e.peData);
133 m_RamDump.SetPEViewerData(e.peData);
134 m_msv.SetPEViewerData(e.peData);
135
136 ConfigPlugin.SetPEViewerData(e.peData);
137 WindowPlugin.SetPEViewerData(e.peData);
138 InputPlugin.SetPEViewerData(e.peData);
139
140 for (int i = 0; i < UserControlPlugins.Count; i++)
141 {
142 UserControlPlugins[i].SetPEViewerData(e.peData);
143 }
144
145 }
146 private void OnBrowseMemoryRegion(BrowseMemoryRegionEvent e)
147 {
148 m_memoryview.BrowseMemoryRegion(e.MemoryRegion);
149 }
150
151 #region Dock Support
152 void AddDockToWindowList(object sender, EventArgs e)
153 {
154 DockContent dc;
155 TypeBinder.Bind(sender, out dc);
156 ToolStripMenuItem tsmi = new ToolStripMenuItem(dc.Text);
157 tsmi.Name = dc.Name;
158 tsmi.Tag = dc;
159 tsmi.Click += new EventHandler(tsmi_Click);
160 mnuWindows.DropDownItems.Add(tsmi);
161 }
162 void tsmi_Click(object sender, EventArgs e)
163 {
164 ToolStripMenuItem tsmi;
165 TypeBinder.Bind(sender, out tsmi);
166 DockContent dc;
167 TypeBinder.Bind(tsmi.Tag, out dc);
168 dc.Activate();
169 }
170 void RemoveDockFromWindowList(object sender, FormClosedEventArgs e)
171 {
172 DockContent dc;
173 TypeBinder.Bind(sender, out dc);
174 mnuWindows.DropDownItems.RemoveByKey(dc.Name);
175 }
176 private IDockContent GetContentFromPersistString(string persistString)
177 {
178 if (persistString == typeof(FloatingLogWindow).ToString()) { return m_LogWindow; }
179 if (persistString == typeof(FloatingRamDumperDialog).ToString()) { return m_RamDump; }
180 if (persistString == typeof(FloatingPIDSelector).ToString()) { return m_PIDSelector; }
181 if (persistString == typeof(FloatingMemoryView).ToString()) { return m_memoryview; }
182 if (persistString == typeof(FloatingDataTypeConverter).ToString()) { return m_typeconverter; }
183 if (persistString == typeof(FloatingMemorySearcher).ToString()) { return m_memsearcher; }
184 if (persistString == typeof(FloatingPEViewer).ToString()) { return m_peviewer; }
185 if (persistString == typeof(FloatingRVACalculator).ToString()) { return m_rvacalc; }
186 if (persistString == typeof(FloatingMemorySectionViewer).ToString()) { return m_msv; }
187 if (persistString == typeof(FloatingUserControlDock).ToString()) { return m_ucd; }
188 if (persistString == typeof(FloatingWebBrowser).ToString()) { return m_wb; }
189 else { return null; }
190 }
191 public void SetupDocks()
192 {
193 m_LogWindow = new FloatingLogWindow();
194 m_AboutBox = new FloatingAboutBox();
195 m_RamDump = new FloatingRamDumperDialog();
196 m_PIDSelector = new FloatingPIDSelector();
197 m_PIDSelector.OnSelectedProcessChanged += new BaseEventHandler<ProcessChangedEventArgs>(OnProcessChanged);
198 m_memoryview = new FloatingMemoryView();
199 m_typeconverter = new FloatingDataTypeConverter();
200 m_memsearcher = new FloatingMemorySearcher();
201 m_memsearcher.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion);
202 m_peviewer = new FloatingPEViewer();
203 m_peviewer.OnPEDataUpdated += new BaseEventHandler<PEViewerDataUpdatedEventArgs>(OnPEDataUpdated);
204 m_rvacalc = new FloatingRVACalculator();
205 m_ucd = new FloatingUserControlDock();
206 m_msv = new FloatingMemorySectionViewer();
207 m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
208 m_wb = new FloatingWebBrowser();
209 }
210 #region SetupDockWindowHandler support
211 public void SetupDockWindowHandler()
212 {
213 SetupLogWindowHandler();
214 SetupRamDumpWindowHandler();
215 SetupMemoryViewWindowHandler();
216 SetupPIDSelectorWindowHandler();
217 SetupDataTypeConverterWindowHandler();
218 SetupMemorySearchWindowHandler();
219 SetupPEViewerWindowHandler();
220 SetupRVACalculatorWindowHandler();
221 SetupMemorySectionViewerWindowHandler();
222 SetupUserControlDockWindowHandler();
223 SetupWebBrowserWindowHandler();
224 }
225 private void SetupLogWindowHandler()
226 {
227 if (m_LogWindow == null) return;
228 m_LogWindow.Shown += new EventHandler(AddDockToWindowList);
229 m_LogWindow.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
230 m_LogWindow.Activate();
231 }
232 private void SetupRamDumpWindowHandler()
233 {
234 if (m_RamDump == null) return;
235 m_RamDump.Shown += new EventHandler(AddDockToWindowList);
236 m_RamDump.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
237 m_RamDump.AcceptedPlugin = ConfigPlugin;
238 m_RamDump.Activate();
239 }
240 private void SetupMemoryViewWindowHandler()
241 {
242 if (m_memoryview == null) return;
243 m_memoryview.Shown += new EventHandler(AddDockToWindowList);
244 m_memoryview.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
245 m_memoryview.AcceptedPlugin = ConfigPlugin;
246 m_memoryview.Activate();
247 }
248 private void SetupPIDSelectorWindowHandler()
249 {
250 if (m_PIDSelector == null) return;
251 m_PIDSelector.Shown += new EventHandler(AddDockToWindowList);
252 m_PIDSelector.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
253 m_PIDSelector.AcceptedPlugin = ConfigPlugin;
254 m_PIDSelector.Activate();
255 }
256 private void SetupDataTypeConverterWindowHandler()
257 {
258 if (m_typeconverter == null) return;
259 m_typeconverter.Shown += new EventHandler(AddDockToWindowList);
260 m_typeconverter.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
261 m_typeconverter.Activate();
262 }
263 private void SetupMemorySearchWindowHandler()
264 {
265 if (m_memsearcher == null) return;
266 m_memsearcher.Shown += new EventHandler(AddDockToWindowList);
267 m_memsearcher.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
268 m_memsearcher.Activate();
269 }
270 private void SetupPEViewerWindowHandler()
271 {
272 if (m_peviewer == null) return;
273 m_peviewer.Shown += new EventHandler(AddDockToWindowList);
274 m_peviewer.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
275 m_PIDSelector.AcceptedPlugin = ConfigPlugin;
276 m_peviewer.Activate();
277 }
278 private void SetupRVACalculatorWindowHandler()
279 {
280 if (m_rvacalc == null) return;
281 m_rvacalc.Shown += new EventHandler(AddDockToWindowList);
282 m_rvacalc.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
283 m_rvacalc.AcceptedPlugin = ConfigPlugin;
284 m_rvacalc.Activate();
285 }
286 private void SetupUserControlDockWindowHandler()
287 {
288 if (m_ucd == null) return;
289 m_ucd.Shown += new EventHandler(AddDockToWindowList);
290 m_ucd.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
291 m_ucd.Activate();
292 }
293 private void SetupMemorySectionViewerWindowHandler()
294 {
295 if (m_msv == null) return;
296 m_msv.Shown += new EventHandler(AddDockToWindowList);
297 m_msv.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
298 m_msv.AcceptedPlugin = ConfigPlugin;
299 m_msv.Activate();
300 }
301 private void SetupWebBrowserWindowHandler()
302 {
303 if (m_wb == null) return;
304 m_wb.Shown += new EventHandler(AddDockToWindowList);
305 m_wb.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
306 m_wb.Activate();
307 }
308 #endregion
309 public void ShowDocks()
310 {
311 ShowLogWindow();
312 SetupLogWindowHandler();
313 //ShowAboutBox();
314 ShowRamDump();
315 SetupRamDumpWindowHandler();
316 ShowMemoryView();
317 SetupMemoryViewWindowHandler();
318 ShowPidSelector();
319 SetupPIDSelectorWindowHandler();
320 ShowDataTypeConverter();
321 SetupDataTypeConverterWindowHandler();
322
323 ShowRVACalculator();
324 SetupRVACalculatorWindowHandler();
325
326 ShowMemorySectionViewer();
327 SetupMemorySectionViewerWindowHandler();
328
329
330
331 ShowUserControlDock();
332 SetupUserControlDockWindowHandler();
333
334 ShowMemorySearch();
335 SetupMemorySearchWindowHandler();
336 ShowPEViewer();
337 SetupPEViewerWindowHandler();
338
339 ShowWebBrowser();
340 SetupWebBrowserWindowHandler();
341 }
342 public void ShowLogWindow()
343 {
344 if (m_LogWindow == null || m_LogWindow.IsDisposed) { m_LogWindow = new FloatingLogWindow(); }
345 LoggerInstance = m_LogWindow.Logwriter;
346 LoggerInstance.CreateNewLog(false);
347 m_LogWindow.Show(dockPanel, DockState.DockBottom);
348 }
349 public void ShowAboutBox()
350 {
351 if (m_AboutBox == null || m_AboutBox.IsDisposed) { m_AboutBox = new FloatingAboutBox(); }
352 m_AboutBox.ShowDialog();
353 }
354 public void ShowRamDump()
355 {
356 //load_plugins_silent();
357 m_RamDump = new FloatingRamDumperDialog(ConfigPlugin);
358 m_RamDump.AcceptedProcess = SelectedProcess;
359 m_RamDump.Show(dockPanel);
360 }
361 public void ShowMemoryView()
362 {
363 //load_plugins_silent();
364 m_memoryview = new FloatingMemoryView(ConfigPlugin);
365 m_memoryview.AcceptedProcess = SelectedProcess;
366 m_memoryview.Show(dockPanel);
367 }
368 public void ShowPidSelector()
369 {
370 //load_plugins_silent();
371 //List<Process> procs = ConfigPlugin.ValidProcessesForPlugin;
372 m_PIDSelector = new FloatingPIDSelector(ConfigPlugin);
373 m_PIDSelector.OnSelectedProcessChanged += new BaseEventHandler<ProcessChangedEventArgs>(OnProcessChanged);
374 m_PIDSelector.Show(dockPanel);
375 }
376 public void ShowDataTypeConverter()
377 {
378 if (m_typeconverter == null || m_typeconverter.IsDisposed) { m_typeconverter = new FloatingDataTypeConverter(); }
379 m_typeconverter.Show(dockPanel, DockState.DockRightAutoHide);
380 }
381 public void ShowMemorySearch()
382 {
383 //load_plugins_silent();
384 m_memsearcher = new FloatingMemorySearcher(ConfigPlugin);
385 m_memsearcher.AcceptedProcess = SelectedProcess;
386 m_memsearcher.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion);
387 m_memsearcher.Show(dockPanel);
388 }
389 public void ShowPEViewer()
390 {
391 //load_plugins_silent();
392 m_peviewer = new FloatingPEViewer(ConfigPlugin);
393 m_peviewer.AcceptedProcess = SelectedProcess;
394 m_peviewer.OnPEDataUpdated += new BaseEventHandler<PEViewerDataUpdatedEventArgs>(OnPEDataUpdated);
395 m_peviewer.Show(dockPanel);
396 }
397 public void ShowRVACalculator()
398 {
399 //load_plugins_silent();
400 m_rvacalc = new FloatingRVACalculator(ConfigPlugin);
401 m_rvacalc.AcceptedProcess = SelectedProcess;
402 m_rvacalc.Show(dockPanel, DockState.DockRightAutoHide);
403 }
404 public void ShowMemorySectionViewer()
405 {
406 //load_plugins_silent();
407 m_msv = new FloatingMemorySectionViewer(ConfigPlugin);
408 m_msv.AcceptedProcess = SelectedProcess;
409 m_msv.Show(dockPanel);
410 }
411 public void ShowUserControlDock()
412 {
413 //load_plugins_silent();
414 if (m_ucd == null)
415 {
416 m_ucd = new FloatingUserControlDock();
417 }
418 if (this.UserControlPlugins.Count > 0)
419 {
420 m_ucd.UserPlugins = this.UserControlPlugins;
421 }
422 m_ucd.Show(dockPanel, DockState.DockRightAutoHide);
423 }
424 public void ShowWebBrowser()
425 {
426 //load_plugins_silent();
427 m_wb = new FloatingWebBrowser();
428 m_wb.Show(dockPanel);
429 }
430 #endregion
431
432
433 public Main() : this(false) { }
434 public Main(bool no_console_redirect)
435 {
436 InitializeComponent();
437 #if SHOW_DEBUG_MENU
438 mnuDebug.Visible = true;
439 #else
440 mnuDebug.Visible = false;
441 #endif
442 SettingsSubscriber = new SettingSubscriber();
443 SettingsSubscriber.AddSubscriber(this, Settings.Default);
444 load_loggerflags();
445 SetupDocks();
446 LoggerInstance = m_LogWindow.Logwriter;
447 LoggerInstance.CreateNewLog(false);
448 logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name);
449 load_plugins();
450 if (no_console_redirect)
451 LoggerInstance.RedirectConsoleOutput = false;
452 }
453 private void load_loggerflags()
454 {
455 logger.SetLoggingFlags(Logging.Properties.Settings.Default.LoggingFlags);
456 #if FORCE_ALL_LOGGING_FLAGS
457 logger.SetLoggingFlags(loggerflags.ALL);
458 #endif
459 }
460 private void load_plugins() { load_plugins(false); }
461 private void load_plugins_silent() { load_plugins(true); }
462 private void load_plugins(bool silent)
463 {
464 loader = new PluginLoader();
465 loader.LoadPlugins(silent);
466
467 ConfigPlugin = loader.GetConfigPlugin(RomCheater.Properties.Settings.Default.LastConfigPlugin);
468 if (ConfigPlugin != null && !silent)
469 logger.Info.WriteLine("Loaded Config Plugin: {0}", ConfigPlugin.ToString());
470 InputPlugin = loader.GetInputPlugin(RomCheater.Properties.Settings.Default.LastInputPlugin);
471 if (InputPlugin != null && !silent)
472 logger.Info.WriteLine("Loaded Input Plugin: {0}", InputPlugin.ToString());
473 WindowPlugin = loader.GetWindowPlugin(RomCheater.Properties.Settings.Default.LastWindowPlugin);
474 if (WindowPlugin != null && !silent)
475 logger.Info.WriteLine("Loaded Window Plugin: {0}", WindowPlugin.ToString());
476
477
478 UserControlPlugins = new List<IUserControlPlugin>(loader.LoadedUserControlPlugins);
479 if (UserControlPlugins != null)
480 {
481 foreach (var t in UserControlPlugins)
482 {
483 if (!silent)
484 logger.Info.WriteLine("Loaded UserControl Plugin: {0}", t.ToString());
485 }
486
487 string stacktrace = System.Environment.StackTrace;
488
489 if (UserControlPlugins.Count > 0)
490 {
491 m_ucd.UserPlugins = UserControlPlugins;
492 }
493 }
494
495 ConfigPlugin.WebBrowserProvider = this.WebBrowserProvider;
496
497
498 m_PIDSelector.AcceptedPlugin = ConfigPlugin;
499 m_RamDump.AcceptedPlugin = ConfigPlugin;
500 m_memoryview.AcceptedPlugin = ConfigPlugin;
501 m_memsearcher.AcceptedPlugin = ConfigPlugin;
502 m_PIDSelector.AcceptedPlugin = ConfigPlugin;
503 if (this.SelectedProcess != null)
504 {
505 m_RamDump.AcceptedProcess = SelectedProcess;
506 m_memoryview.AcceptedProcess = SelectedProcess;
507 m_memsearcher.AcceptedProcess = SelectedProcess;
508 }
509
510
511 }
512
513 private void mnuItemExit_Click(object sender, EventArgs e)
514 {
515 this.Close();
516 }
517
518
519 private void Main_Load(object sender, EventArgs e)
520 {
521 SettingsSubscriber.SaveSettings();
522 }
523
524 private void mnuItemConfig_Click(object sender, EventArgs e)
525 {
526 RomCheaterConfigDialog dlg = new RomCheaterConfigDialog(loader);
527 dlg.ShowDialog();
528 logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name);
529 // reload plugins
530 load_plugins(true);
531 }
532
533 private void mnuItemOpenProcess_Click(object sender, EventArgs e)
534 {
535 ////List<Process> procs = ConfigPlugin.ValidProcessesForPlugin;
536 //PIDSelector selector = new PIDSelector(ConfigPlugin);
537 //selector.ShowDialog();
538 }
539
540 private void Main_Shown(object sender, EventArgs e)
541 {
542 //dockPanel.SuspendLayout(true);
543 //ShowDocks();
544 string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), DockPanelConfig);
545 if (File.Exists(configFile))
546 {
547 try
548 {
549 dockPanel.LoadFromXml(configFile, m_deserializeDockContent);
550 SetupDockWindowHandler();
551 }
552 catch (Exception)
553 {
554 this.Controls.Remove(dockPanel);
555 dockPanel = new DockPanel();
556 dockPanel.Dock = DockStyle.Fill;
557 dockPanel.DocumentStyle = DocumentStyle.DockingWindow;
558 this.Controls.Add(dockPanel);
559 ShowDocks();
560 }
561 }
562 else
563 {
564 ShowDocks();
565 }
566
567 //dockPanel.ResumeLayout(true, true);
568 }
569
570 private void mnuItemShowLogWindow_Click(object sender, EventArgs e)
571 {
572 ShowLogWindow();
573 }
574
575 private void mnuItemHelpAbout_Click(object sender, EventArgs e)
576 {
577 ShowAboutBox();
578 }
579
580 private void mnuItemShowRamDumpDialog_Click(object sender, EventArgs e)
581 {
582 ShowRamDump();
583 }
584
585 private void mnuItemShowPIDSelector_Click(object sender, EventArgs e)
586 {
587 ShowPidSelector();
588 }
589 private void mnuItemShowMemoryView_Click(object sender, EventArgs e)
590 {
591 ShowMemoryView();
592 }
593 private void Main_FormClosing(object sender, FormClosingEventArgs e)
594 {
595 SettingsSubscriber.SaveSettings();
596 string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), DockPanelConfig);
597 if (m_bSaveLayout)
598 dockPanel.SaveAsXml(configFile);
599 else if (File.Exists(configFile))
600 File.Delete(configFile);
601
602 SearchResultWriter.CleanupTemporarySearchResultFiles();
603
604
605 // notify any docked windows of formclosing
606
607 foreach (var t in this.dockPanel.Contents)
608 {
609 t.OnDeactivate<FormClosingEventArgs>(e);
610 }
611
612 }
613
614 private void mnuTestExeParse_Click(object sender, EventArgs e)
615 {
616 IPEDData peData = new PEData((IAcceptsProcessAndConfig)this);
617 }
618
619 private void mnuItemFindMaxNonNegativeHexValue_Click(object sender, EventArgs e)
620 {
621
622 //uint start = 0xf0000000;
623 uint end = uint.MaxValue;
624 //for (uint i = start; i < end; i++)
625 //{
626 ulong value = Convert.ToUInt64(end.ToString(), 16);
627 //}
628 }
629
630 private void mnuItemShowDataTypeConverter_Click(object sender, EventArgs e)
631 {
632 ShowDataTypeConverter();
633 }
634
635 private void mnuItemShowMemorySearch_Click(object sender, EventArgs e)
636 {
637 ShowMemorySearch();
638 }
639
640 private void mnuItemDateShift_Click(object sender, EventArgs e)
641 {
642 DateTime t = DateTime.Now;
643 int year = Convert.ToInt32(t.ToString("yy"));
644 int y = year << 9;
645 int m = t.Month << 5;
646 int d = t.Day;
647
648 ushort v1 = (ushort)(y | m | d);
649
650 t = t.AddDays(1);
651 year = Convert.ToInt32(t.ToString("yy"));
652 y = year << 9;
653 m = t.Month << 5;
654 d = t.Day;
655 ushort v2 = (ushort)(y | m | d);
656
657 t = t.AddDays(1);
658 year = Convert.ToInt32(t.ToString("yy"));
659 y = year << 9;
660 m = t.Month << 5;
661 d = t.Day;
662 ushort v3 = (ushort)(y | m | d);
663
664 t = new DateTime(9999,12,31);
665 year = Convert.ToInt32(t.ToString("yy"));
666 y = year << 9;
667 m = t.Month << 5;
668 d = t.Day;
669 ushort v4 = (ushort)(y | m | d);
670 }
671
672 private void mnuItemShowPEViewer_Click(object sender, EventArgs e)
673 {
674 ShowPEViewer();
675 }
676
677 private void mnuItemShowRVACalculator_Click(object sender, EventArgs e)
678 {
679 ShowRVACalculator();
680 }
681
682 private void mnuItemShowUserControlDock_Click(object sender, EventArgs e)
683 {
684 ShowUserControlDock();
685 }
686
687 private void mnuItemShowMemorySectionViewer_Click(object sender, EventArgs e)
688 {
689 ShowMemorySectionViewer();
690 }
691
692 private void mnuItemShowWebBrowser_Click(object sender, EventArgs e)
693 {
694 ShowWebBrowser();
695 }
696 }
697 }

  ViewVC Help
Powered by ViewVC 1.1.22