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

Contents of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 680 - (show annotations) (download)
Mon Jun 17 08:03:34 2013 UTC (8 years, 4 months ago) by william
File size: 26861 byte(s)

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

  ViewVC Help
Powered by ViewVC 1.1.22