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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 711 - (show annotations) (download)
Tue Jun 18 08:36:08 2013 UTC (7 years, 5 months ago) by william
File size: 6010 byte(s)
+ add ability to find a plugin by guid or name
** will be adding (in next commit) a static class that can get the value(s) like an enum of plugins

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 IWebBrowserInterface WebBrowserInterface { get; }
36
37
38 }
39 #region IPluginBase SubMembers
40 public interface IToString { string ToString(); }
41 public interface IPluginName { string Name { get; } }
42 public interface IPluginDescription { string Description { get; } }
43 public interface IPluginID { Guid ID { get; } }
44 public interface IPluginRefresh { void Reload(); void Reload(bool silent); }
45 #endregion
46 #endregion
47 #region IConfigPlugin
48 public interface IConfigPlugin : IPluginBase, IAcceptsReadOnlyMemoryRange, ISearchInProgress, IAcceptsMemorySearch
49 {
50 List<ProcContainer> ValidProcessesForPlugin { get; }
51 IWebBrowserProvider WebBrowserProvider { get; set; }
52 }
53 #endregion
54 #region IInputPlugin
55 public interface IInputPlugin : IPluginBase
56 {
57 }
58 #endregion
59 #region IWindowPlugin
60 public interface IWindowPlugin : IPluginBase
61 {
62 }
63 #endregion
64 #region IUserControlPlugin
65 public interface IUserControlPlugin : IPluginBase
66 {
67 void Show();
68 void Show(DockPanel dockPanel);
69 void Show(DockPanel dockPanel, DockState dockState);
70 void Config();
71 }
72 #endregion
73 #region IPluginLoader
74 public interface IPluginLoader
75 {
76 void LoadPlugins();
77 void LoadPlugins(bool silent);
78 List<IConfigPlugin> LoadedConfigPlugins { get; }
79 List<IInputPlugin> LoadedInputPlugins { get; }
80 List<IWindowPlugin> LoadedWindowPlugins { get; }
81 List<IUserControlPlugin> LoadedUserControlPlugins { get; }
82
83 IConfigPlugin GetConfigPlugin(string t);
84 IInputPlugin GetInputPlugin(string t);
85 IWindowPlugin GetWindowPlugin(string t);
86
87 IConfigPlugin GetGenericConfigPlugin();
88 IInputPlugin GetGenericInputPlugin();
89 IWindowPlugin GetGenericWindowPlugin();
90
91 T GetPluginByName<T>(string name) where T : IPluginBase;
92 T GetPluginByGuid<T>(string t) where T : IPluginBase;
93 string[] GetKnownPluginGuids<T>() where T : IPluginBase;
94 bool IsKnownPluginGuid<T>(string t, out T plugin) where T : IPluginBase;
95 bool IsKnownPluginName<T>(string plugin_name, out T plugin) where T : IPluginBase;
96
97 string ToString();
98 }
99 #endregion
100 #region AcceptsPlugin
101 public interface IAcceptsPlugin<TPlugin>
102 where TPlugin : IPluginBase
103 {
104 TPlugin AcceptedPlugin { get; set; }
105 }
106 public interface IAcceptsConfig : IAcceptsPlugin<IConfigPlugin> { }
107 public interface IAcceptsProcess : IAcceptsProcess<Process> { }
108 public interface IAcceptsProcess<TProcess>
109 where TProcess : Process
110 {
111 TProcess AcceptedProcess { get; set; }
112 }
113 #endregion
114
115
116 public interface IAcceptsProcessAndConfig<TProcess> : IAcceptsConfig, IAcceptsProcess<TProcess> where TProcess : Process { }
117 public interface IAcceptsProcessAndConfig : IAcceptsProcess, IAcceptsConfig { }
118
119
120 public class AcceptedProcessAndConfig<TProcess> : IAcceptsProcessAndConfig<TProcess> where TProcess : Process
121 {
122 public AcceptedProcessAndConfig() : this(null, default(TProcess)) { }
123 public AcceptedProcessAndConfig(IConfigPlugin config, TProcess process) { AcceptedPlugin = config; AcceptedProcess = process; }
124 #region IAcceptsProcessAndConfig<TProcess> members
125 #endregion
126
127 #region IAcceptsPlugin<IConfigPlugin> Members
128 public IConfigPlugin AcceptedPlugin { get; set; }
129 #endregion
130
131 #region IAcceptsProcess<TProcess> Members
132 public TProcess AcceptedProcess { get; set; }
133 #endregion
134 }
135 public class AcceptedProcessAndConfig : IAcceptsProcessAndConfig
136 {
137 public AcceptedProcessAndConfig() : this(null, null) { }
138 public AcceptedProcessAndConfig(IConfigPlugin config, Process process) { AcceptedPlugin = config; AcceptedProcess = process; }
139
140 #region IAcceptsProcess<Process> Members
141 public Process AcceptedProcess { get; set; }
142 #endregion
143 #region IAcceptsPlugin<IConfigPlugin> Members
144 public IConfigPlugin AcceptedPlugin { get; set; }
145 #endregion
146 }
147
148 public interface IAcceptsProcessPID
149 {
150 int ProcessPID { get; set; }
151 }
152 public interface IAcceptsMemoryRange
153 {
154 ulong MemoryRangeStart { get; set; }
155 ulong MemoryRangeSize { get; set; }
156 }
157 public interface IAcceptsReadOnlyMemoryRange
158 {
159 ulong MemoryRangeStart { get; }
160 ulong MemoryRangeSize { get; }
161 }
162 public interface IOutputsData<TData> { TData Data { get; } }
163 public interface ISearchInProgress
164 {
165 bool SearchInProgess { get; }
166 Guid SearchGuid { get; }
167 }
168 }

  ViewVC Help
Powered by ViewVC 1.1.22