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

Contents of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.22