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

Diff of /trunk/RomCheater/Docking/FloatingMemorySearcher.cs

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

--- trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2012/06/03 13:04:02	242
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2012/06/03 13:21:51	243
@@ -20,8 +20,9 @@
 namespace RomCheater.Docking
 {
     public partial class FloatingMemorySearcher : DockContent, 
-        IAcceptsProcess<Process>, 
-        IAcceptsPlugin<IConfigPlugin>, 
+       IAcceptsPlugin<IConfigPlugin>,
+        IAcceptsProcess<Process>,
+        IAcceptsProcessAndConfig,
         ISearchInProgress
     {
         private bool DefaultUnsignedState = true; // set unsigned to true
@@ -30,11 +31,20 @@
         public FloatingMemorySearcher(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; }
 
         #region IAcceptsProcess<Process> Members
-        public Process AcceptedProcess { get; set; }
+        private Process _AcceptedProcess;
+        public Process AcceptedProcess { get { return _AcceptedProcess; } set { _AcceptedProcess = value; UpdateAcceptedProcessAndConfig(AcceptedPlugin, value); } }
         #endregion
         #region IAcceptsPlugin<IConfigPlugin> Members
-        public IConfigPlugin AcceptedPlugin { get; set; }
+        private IConfigPlugin _AcceptedPlugin;
+        public IConfigPlugin AcceptedPlugin { get { return _AcceptedPlugin; } set { _AcceptedPlugin = value; UpdateAcceptedProcessAndConfig(value, AcceptedProcess); } }
         #endregion
+        private void UpdateAcceptedProcessAndConfig(IConfigPlugin config, Process process)
+        {
+            this.lstResults.AcceptedPlugin = config;
+            this.lstResults.AcceptedProcess = process;
+            this.lstPatchList.AcceptedPlugin = config;
+            this.lstPatchList.AcceptedProcess = process;
+        }
         #region ISearchInProgress members
         public bool SearchInProgess { get; private set; } 
         #endregion
@@ -715,7 +725,7 @@
                             if (_result.IsUnsigned)
                             {
                                 byte value = Convert.ToByte(item.SubItems[col_Found_Value].Text, 16);
-                                patcher = new SearchPatcher(this.AcceptedProcess.Id, Address, value);
+                                patcher = new SearchPatcher((IAcceptsProcessAndConfig)this, Address, value);
                                 timer_update_results.Enabled = false;
                                 patcher.ShowDialog();
                                 timer_update_results.Enabled = true;
@@ -726,7 +736,7 @@
                             else
                             {
                                 sbyte value = Convert.ToSByte(item.SubItems[col_Found_Value].Text, 16);
-                                patcher = new SearchPatcher(this.AcceptedProcess.Id, Address, value);
+                                patcher = new SearchPatcher((IAcceptsProcessAndConfig)this, Address, value);
                                 timer_update_results.Enabled = false;
                                 patcher.ShowDialog();
                                 timer_update_results.Enabled = true;
@@ -739,7 +749,7 @@
                             if (_result.IsUnsigned)
                             {
                                 ushort value = Convert.ToUInt16(item.SubItems[col_Found_Value].Text, 16);
-                                patcher = new SearchPatcher(this.AcceptedProcess.Id, Address, value);
+                                patcher = new SearchPatcher((IAcceptsProcessAndConfig)this, Address, value);
                                 timer_update_results.Enabled = false;
                                 patcher.ShowDialog();
                                 timer_update_results.Enabled = true;
@@ -750,7 +760,7 @@
                             else
                             {
                                 short value = Convert.ToInt16(item.SubItems[col_Found_Value].Text, 16);
-                                patcher = new SearchPatcher(this.AcceptedProcess.Id, Address, value);
+                                patcher = new SearchPatcher((IAcceptsProcessAndConfig)this, Address, value);
                                 timer_update_results.Enabled = false;
                                 patcher.ShowDialog();
                                 timer_update_results.Enabled = true;
@@ -763,7 +773,7 @@
                             if (_result.IsUnsigned)
                             {
                                 uint value = Convert.ToUInt32(item.SubItems[col_Found_Value].Text, 16);
-                                patcher = new SearchPatcher(this.AcceptedProcess.Id, Address, value);
+                                patcher = new SearchPatcher((IAcceptsProcessAndConfig)this, Address, value);
                                 timer_update_results.Enabled = false;
                                 patcher.ShowDialog();
                                 timer_update_results.Enabled = true;
@@ -774,7 +784,7 @@
                             else
                             {
                                 int value = Convert.ToInt32(item.SubItems[col_Found_Value].Text, 16);
-                                patcher = new SearchPatcher(this.AcceptedProcess.Id, Address, value);
+                                patcher = new SearchPatcher((IAcceptsProcessAndConfig)this, Address, value);
                                 timer_update_results.Enabled = false;
                                 patcher.ShowDialog();
                                 timer_update_results.Enabled = true;
@@ -787,7 +797,7 @@
                             if (_result.IsUnsigned)
                             {
                                 ulong value = Convert.ToUInt32(item.SubItems[col_Found_Value].Text, 16);
-                                patcher = new SearchPatcher(this.AcceptedProcess.Id, Address, value);
+                                patcher = new SearchPatcher((IAcceptsProcessAndConfig)this, Address, value);
                                 timer_update_results.Enabled = false;
                                 patcher.ShowDialog();
                                 timer_update_results.Enabled = true;
@@ -798,7 +808,7 @@
                             else
                             {
                                 long value = Convert.ToInt32(item.SubItems[col_Found_Value].Text, 16);
-                                patcher = new SearchPatcher(this.AcceptedProcess.Id, Address, value);
+                                patcher = new SearchPatcher((IAcceptsProcessAndConfig)this, Address, value);
                                 timer_update_results.Enabled = false;
                                 patcher.ShowDialog();
                                 timer_update_results.Enabled = true;
@@ -820,7 +830,7 @@
 
             if (patch_list.Count > 0)
             {
-                SearchRangePatcher rangePatcher = new SearchRangePatcher(this.AcceptedProcess.Id, patch_list);
+                SearchRangePatcher rangePatcher = new SearchRangePatcher((IAcceptsProcessAndConfig)this, patch_list);
                 rangePatcher.ShowDialog();
             }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22