/[RomCheater]/trunk/RomCheater/Docking/MemorySearch/SearchPatcher.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/MemorySearch/SearchPatcher.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/MemorySearch/SearchPatcher.cs	2012/06/03 13:04:02	242
+++ trunk/RomCheater/Docking/MemorySearch/SearchPatcher.cs	2012/06/03 13:21:51	243
@@ -9,77 +9,87 @@
 using System.Diagnostics;
 using RomCheater.Logging;
 using Sojaner.MemoryScanner.MemoryProviers;
+using RomCheater.PluginFramework.Interfaces;
 
 
 namespace RomCheater.Docking.MemorySearch
 {
-    public partial class SearchPatcher : Form
+    public partial class SearchPatcher : Form,
+               IAcceptsPlugin<IConfigPlugin>,
+        IAcceptsProcess<Process>,
+        IAcceptsProcessAndConfig
     {
+        #region  IAcceptsProcess<Process> Members
+        public Process AcceptedProcess { get; set; }
+        #endregion
+        #region IAcceptsPlugin<IConfigPlugin> Members
+        public IConfigPlugin AcceptedPlugin { get; set; }
+        #endregion
         //PCSX2MemoryProvider provider;
-        private int pid = -1;
         SearchDataTypes DataType;
         bool Unsigned = false;
-        public SearchPatcher(int pid, uint Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address)
         {
             InitializeComponent();
-            this.pid = pid;
+            this.AcceptedPlugin = pconfig.AcceptedPlugin;
+            this.AcceptedProcess = pconfig.AcceptedProcess;
             txtAddress.Text = string.Format("0x{0:x8}", Address);
         }
-        public SearchPatcher(int pid, uint Address, byte Value)
-            : this(pid, Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, byte Value)
+            : this(pconfig, Address)
         {
             Unsigned = true;
             DataType = SearchDataTypes._8bits;
             txtValue.CreateTypeSize<byte>();          
             txtValue.Text = string.Format("0x{0:x2}", Value);
         }
-        public SearchPatcher(int pid, uint Address, sbyte Value)
-            : this(pid, Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, sbyte Value)
+            : this(pconfig, Address)
         {
             DataType = SearchDataTypes._8bits;
             txtValue.CreateTypeSize<sbyte>();            
             txtValue.Text = string.Format("0x{0:x2}", Value);
         }
-        public SearchPatcher(int pid, uint Address, ushort Value)
-            : this(pid, Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, ushort Value)
+            : this(pconfig, Address)
         {
             Unsigned = true;
             DataType = SearchDataTypes._16bits;
             txtValue.CreateTypeSize<ushort>();            
             txtValue.Text = string.Format("0x{0:x4}", Value);
         }
-        public SearchPatcher(int pid, uint Address, short Value)
-            : this(pid, Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, short Value)
+            : this(pconfig, Address)
         {
             DataType = SearchDataTypes._16bits;
             txtValue.CreateTypeSize<short>();            
             txtValue.Text = string.Format("0x{0:x4}", Value);
         }
-        public SearchPatcher(int pid, uint Address, uint Value)
-            : this(pid, Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, uint Value)
+            : this(pconfig, Address)
         {            
             Unsigned = true;
             DataType = SearchDataTypes._32bits;
             txtValue.CreateTypeSize<uint>();            
             txtValue.Text = string.Format("0x{0:x8}", Value);
         }
-        public SearchPatcher(int pid, uint Address, int Value)
-            : this(pid, Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, int Value)
+            : this(pconfig, Address)
         {            
             DataType = SearchDataTypes._32bits;
             txtValue.CreateTypeSize<int>();            
             txtValue.Text = string.Format("0x{0:x8}", Value);
         }
-        public SearchPatcher(int pid, uint Address, ulong Value)
-            : this(pid, Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, ulong Value)
+            : this(pconfig, Address)
         {
             Unsigned = true;
             DataType = SearchDataTypes._64bits;
             txtValue.CreateTypeSize<ulong>();
             txtValue.Text = string.Format("0x{0:x16}", Value);
         }
-        public SearchPatcher(int pid, uint Address, long Value)
-            : this(pid, Address)
+        public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, long Value)
+            : this(pconfig, Address)
         {
             DataType = SearchDataTypes._64bits;
             txtValue.CreateTypeSize<long>();
@@ -98,7 +108,7 @@
         {
             uint Address = txtAddress.ToUInt32();
 
-            GenericMemoryProvider provider = new GenericMemoryProvider(null, Process.GetProcessById(pid));
+            GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this);
             switch (DataType)
             {
                 case SearchDataTypes._8bits:

 

  ViewVC Help
Powered by ViewVC 1.1.22