/[RomCheater]/trunk/RomCheater.Core/PluginInterfaces.cs
ViewVC logotype

Contents of /trunk/RomCheater.Core/PluginInterfaces.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 689 - (show annotations) (download)
Mon Jun 17 10:02:53 2013 UTC (7 years, 4 months ago) by william
File size: 5359 byte(s)
+ add support for plugin framework events to be fired, the first time
* Process change events would not fire, until another process was selected (ignoreing the already selected process at startup)
** same goes for the other events that rely on a process being passed in

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using WeifenLuo.WinFormsUI.Docking;
6 using System.Diagnostics;
7 using ManagedWinapi;
8
9 namespace RomCheater.Core
10 {
11 #region t
12 public interface IExposedPluginData :
13 IAcceptPEData,
14 IAcceptsPEData,
15 IAcceptsChangedProcess,
16 IAcceptsChangedConfig
17 {
18 void SetAcceptedProcess(Process proc);
19 void SetAcceptedConfig(IConfigPlugin config);
20 void SetAcceptedProcessAndConfig(IAcceptsProcessAndConfig iapc);
21 }
22 #endregion
23 #region IPluginBase
24 public interface IPluginBase : IPluginName, IPluginDescription, IPluginID, IToString, IPluginRefresh, IExposedPluginData
25 {
26 bool IsNullPlugin { get; }
27 bool IsGenericPlugin { get; }
28
29 void ReadProcessMemory(ulong MemoryAddress, ulong bytesToRead, out ulong bytesRead, out byte[] data);
30 void WriteProcessMemory(long MemoryAddress, byte[] bytesToWrite, out ulong bytesWritten);
31 List<MEMORY_REGION_INFORMATION> QueryMemoryRegions();
32
33 void RaisePluginFrameworkEvents();
34
35 }
36 #region IPluginBase SubMembers
37 public interface IToString { string ToString(); }
38 public interface IPluginName { string Name { get; } }
39 public interface IPluginDescription { string Description { get; } }
40 public interface IPluginID { Guid ID { get; } }
41 public interface IPluginRefresh { void Reload(); void Reload(bool silent); }
42 #endregion
43 #endregion
44 #region IConfigPlugin
45 public interface IConfigPlugin : IPluginBase, IAcceptsReadOnlyMemoryRange, ISearchInProgress, IAcceptsMemorySearch
46 {
47 List<ProcContainer> ValidProcessesForPlugin { get; }
48 }
49 #endregion
50 #region IInputPlugin
51 public interface IInputPlugin : IPluginBase
52 {
53 }
54 #endregion
55 #region IWindowPlugin
56 public interface IWindowPlugin : IPluginBase
57 {
58 }
59 #endregion
60 #region IUserControlPlugin
61 public interface IUserControlPlugin : IPluginBase
62 {
63 void Show();
64 void Show(DockPanel dockPanel);
65 void Show(DockPanel dockPanel, DockState dockState);
66 void Config();
67 }
68 #endregion
69 #region IPluginLoader
70 public interface IPluginLoader
71 {
72 void LoadPlugins();
73 void LoadPlugins(bool silent);
74 List<IConfigPlugin> LoadedConfigPlugins { get; }
75 List<IInputPlugin> LoadedInputPlugins { get; }
76 List<IWindowPlugin> LoadedWindowPlugins { get; }
77 List<IUserControlPlugin> LoadedUserControlPlugins { get; }
78
79 IConfigPlugin GetConfigPlugin(string t);
80 IInputPlugin GetInputPlugin(string t);
81 IWindowPlugin GetWindowPlugin(string t);
82
83 string ToString();
84 }
85 #endregion
86 #region AcceptsPlugin
87 public interface IAcceptsPlugin<TPlugin>
88 where TPlugin : IPluginBase
89 {
90 TPlugin AcceptedPlugin { get; set; }
91 }
92 public interface IAcceptsConfig : IAcceptsPlugin<IConfigPlugin> { }
93 public interface IAcceptsProcess : IAcceptsProcess<Process> { }
94 public interface IAcceptsProcess<TProcess>
95 where TProcess : Process
96 {
97 TProcess AcceptedProcess { get; set; }
98 }
99 #endregion
100
101
102 public interface IAcceptsProcessAndConfig<TProcess> : IAcceptsConfig, IAcceptsProcess<TProcess> where TProcess : Process { }
103 public interface IAcceptsProcessAndConfig : IAcceptsProcess, IAcceptsConfig { }
104
105
106 public class AcceptedProcessAndConfig<TProcess> : IAcceptsProcessAndConfig<TProcess> where TProcess : Process
107 {
108 public AcceptedProcessAndConfig() : this(null, default(TProcess)) { }
109 public AcceptedProcessAndConfig(IConfigPlugin config, TProcess process) { AcceptedPlugin = config; AcceptedProcess = process; }
110 #region IAcceptsProcessAndConfig<TProcess> members
111 #endregion
112
113 #region IAcceptsPlugin<IConfigPlugin> Members
114 public IConfigPlugin AcceptedPlugin { get; set; }
115 #endregion
116
117 #region IAcceptsProcess<TProcess> Members
118 public TProcess AcceptedProcess { get; set; }
119 #endregion
120 }
121 public class AcceptedProcessAndConfig : IAcceptsProcessAndConfig
122 {
123 public AcceptedProcessAndConfig() : this(null, null) { }
124 public AcceptedProcessAndConfig(IConfigPlugin config, Process process) { AcceptedPlugin = config; AcceptedProcess = process; }
125
126 #region IAcceptsProcess<Process> Members
127 public Process AcceptedProcess { get; set; }
128 #endregion
129 #region IAcceptsPlugin<IConfigPlugin> Members
130 public IConfigPlugin AcceptedPlugin { get; set; }
131 #endregion
132 }
133
134 public interface IAcceptsProcessPID
135 {
136 int ProcessPID { get; set; }
137 }
138 public interface IAcceptsMemoryRange
139 {
140 ulong MemoryRangeStart { get; set; }
141 ulong MemoryRangeSize { get; set; }
142 }
143 public interface IAcceptsReadOnlyMemoryRange
144 {
145 ulong MemoryRangeStart { get; }
146 ulong MemoryRangeSize { get; }
147 }
148 public interface IOutputsData<TData> { TData Data { get; } }
149 public interface ISearchInProgress
150 {
151 bool SearchInProgess { get; }
152 Guid SearchGuid { get; }
153 }
154 }

  ViewVC Help
Powered by ViewVC 1.1.22