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

Contents of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.22