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

Contents of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 699 - (show annotations) (download)
Mon Jun 17 12:40:47 2013 UTC (7 years, 3 months ago) by william
File size: 28061 byte(s)
+ work out passing around the webbrowser through the config plugin

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

  ViewVC Help
Powered by ViewVC 1.1.22