/[RomCheater]/trunk/RomCheater/Docking/FloatingMemorySectionViewer.cs
ViewVC logotype

Contents of /trunk/RomCheater/Docking/FloatingMemorySectionViewer.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 600 - (show annotations) (download)
Fri Jun 7 10:27:53 2013 UTC (7 years, 5 months ago) by william
File size: 3446 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 using WeifenLuo.WinFormsUI.Docking;
10 using RomCheater.PluginFramework.Interfaces;
11 using System.Diagnostics;
12 using RomCheater.PluginFramework.Events;
13 using Sojaner.MemoryScanner;
14 using Sojaner.MemoryScanner.MemoryProviers;
15 using ManagedWinapi;
16
17 namespace RomCheater.Docking
18 {
19 public partial class FloatingMemorySectionViewer : DockContent,
20 IAcceptsPlugin<IConfigPlugin>,
21 IAcceptsProcess<Process>,
22 IAcceptsProcessAndConfig,
23 IAcceptPEData
24 {
25 public FloatingMemorySectionViewer()
26 {
27 InitializeComponent();
28 }
29
30 public FloatingMemorySectionViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }
31 public FloatingMemorySectionViewer(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; }
32
33 #region IAcceptsPlugin<IConfigPlugin> Members
34 private IConfigPlugin _AcceptedPlugin;
35 public IConfigPlugin AcceptedPlugin { get { return _AcceptedPlugin; } set { _AcceptedPlugin = value; UpdateAcceptedPlugin(value); } }
36 private void UpdateAcceptedPlugin(IConfigPlugin config)
37 {
38 if (config == null) { return; }
39 // perform processing when config plugin is updated
40 }
41 #endregion
42 #region IAcceptsProcess<Process> Members
43 private Process _AcceptedProcess;
44 public Process AcceptedProcess { get { return _AcceptedProcess; } set { _AcceptedProcess = value; UpdateAcceptedProcess(value); } }
45 private void UpdateAcceptedProcess(Process process)
46 {
47 if (process == null) { return; }
48 // perform processing when process is updated
49 List<MEMORY_REGION_INFORMATION> regions = new List<MEMORY_REGION_INFORMATION>();
50 using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
51 {
52 provider.OpenProvider();
53 if (this.PEData != null)
54 {
55 if (this.PEData.Is32bitAssembly())
56 {
57 regions = provider.QueryMemoryRegions(MemorySizeConstants.MinimumAddress, MemorySizeConstants.MaximumAddressSize_x86);
58 }
59 else
60 {
61 regions = provider.QueryMemoryRegions(MemorySizeConstants.MinimumAddress, MemorySizeConstants.MaximumAddressSize_x64);
62 }
63 }
64 else
65 {
66 regions = provider.QueryMemoryRegions(MemorySizeConstants.MinimumAddress, MemorySizeConstants.MaximumAddressSize_x86);
67 }
68
69 provider.CloseProvider();
70 }
71
72 }
73 #endregion
74
75 #region IAcceptPEData Members
76 private IPEDData _PEData;
77 private IPEDData PEData { get { return _PEData; } set { _PEData = value; } }
78 public void SetPEViewerData(Sojaner.MemoryScanner.IPEDData peData)
79 {
80 this.PEData = peData;
81 }
82 #endregion
83
84
85 public object MEMORY_REGION_INFORMATION { get; set; }
86 }
87 }

  ViewVC Help
Powered by ViewVC 1.1.22