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 |
|
16 |
namespace RomCheater.Docking |
17 |
{ |
18 |
public partial class FloatingMemorySectionViewer : DockContent, |
19 |
IAcceptsPlugin<IConfigPlugin>, |
20 |
IAcceptsProcess<Process>, |
21 |
IAcceptsProcessAndConfig, |
22 |
IAcceptPEData |
23 |
{ |
24 |
public FloatingMemorySectionViewer() |
25 |
{ |
26 |
InitializeComponent(); |
27 |
} |
28 |
|
29 |
public FloatingMemorySectionViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; } |
30 |
public FloatingMemorySectionViewer(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; } |
31 |
|
32 |
#region IAcceptsPlugin<IConfigPlugin> Members |
33 |
private IConfigPlugin _AcceptedPlugin; |
34 |
public IConfigPlugin AcceptedPlugin { get { return _AcceptedPlugin; } set { _AcceptedPlugin = value; UpdateAcceptedPlugin(value); } } |
35 |
private void UpdateAcceptedPlugin(IConfigPlugin config) |
36 |
{ |
37 |
if (config == null) { return; } |
38 |
// perform processing when config plugin is updated |
39 |
} |
40 |
#endregion |
41 |
#region IAcceptsProcess<Process> Members |
42 |
private Process _AcceptedProcess; |
43 |
public Process AcceptedProcess { get { return _AcceptedProcess; } set { _AcceptedProcess = value; UpdateAcceptedProcess(value); } } |
44 |
private void UpdateAcceptedProcess(Process process) |
45 |
{ |
46 |
if (process == null) { return; } |
47 |
// perform processing when process is updated |
48 |
|
49 |
using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this)) |
50 |
{ |
51 |
provider.OpenProvider(); |
52 |
provider.QueryMemoryRegion(); |
53 |
provider.CloseProvider(); |
54 |
} |
55 |
|
56 |
} |
57 |
#endregion |
58 |
|
59 |
#region IAcceptPEData Members |
60 |
private IPEDData _PEData; |
61 |
private IPEDData PEData { get { return _PEData; } set { _PEData = value; } } |
62 |
public void SetPEViewerData(Sojaner.MemoryScanner.IPEDData peData) |
63 |
{ |
64 |
this.PEData = peData; |
65 |
} |
66 |
#endregion |
67 |
|
68 |
} |
69 |
} |