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

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

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

--- trunk/RomCheater/Docking/MemorySearch/AddressValuePairList.cs	2012/06/19 07:56:36	378
+++ trunk/RomCheater/Docking/MemorySearch/AddressValuePairList.cs	2012/06/20 12:16:34	398
@@ -483,31 +483,34 @@
                 {
                     iter = (ResultItem)this.Items[index];
                 }
-                GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this);
-                provider.OpenProvider();
-                ResultDataType result = (ResultDataType)iter.Tag;
-                uint Address = result.Address;
-                byte[] bitData = new byte[] { };
-                switch (result.ValueType)
+                using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
                 {
-                    case SearchDataTypes._8bits:
-                        if (result.IsUnsigned) { provider.PatchMemory(Address, Convert.ToByte(result.Value)); }
-                        else { provider.PatchMemory(Address, Convert.ToSByte(result.Value)); }
-                        break;
-                    case SearchDataTypes._16bits:
-                        if (result.IsUnsigned) { provider.PatchMemory(Address, Convert.ToUInt16(result.Value)); }
-                        else { provider.PatchMemory(Address, Convert.ToInt16(result.Value)); }
-                        break;
-                    case SearchDataTypes._32bits:
-                        if (result.IsUnsigned) { provider.PatchMemory(Address, Convert.ToUInt32(result.Value)); }
-                        else { provider.PatchMemory(Address, Convert.ToInt32(result.Value)); }
-                        break;
-                    case SearchDataTypes._64bits:
-                        if (result.IsUnsigned) { provider.PatchMemory(Address, Convert.ToUInt64(result.Value)); }
-                        else { provider.PatchMemory(Address, Convert.ToInt64(result.Value)); }
-                        break;
+                    provider.OpenProvider();
+                    ResultDataType result = (ResultDataType)iter.Tag;
+                    uint Address = result.Address;
+                    byte[] bitData = new byte[] { };
+                    switch (result.ValueType)
+                    {
+                        case SearchDataTypes._8bits:
+                            if (result.IsUnsigned) { provider.PatchMemory(Address, Convert.ToByte(result.Value)); }
+                            else { provider.PatchMemory(Address, Convert.ToSByte(result.Value)); }
+                            break;
+                        case SearchDataTypes._16bits:
+                            if (result.IsUnsigned) { provider.PatchMemory(Address, Convert.ToUInt16(result.Value)); }
+                            else { provider.PatchMemory(Address, Convert.ToInt16(result.Value)); }
+                            break;
+                        case SearchDataTypes._32bits:
+                            if (result.IsUnsigned) { provider.PatchMemory(Address, Convert.ToUInt32(result.Value)); }
+                            else { provider.PatchMemory(Address, Convert.ToInt32(result.Value)); }
+                            break;
+                        case SearchDataTypes._64bits:
+                            if (result.IsUnsigned) { provider.PatchMemory(Address, Convert.ToUInt64(result.Value)); }
+                            else { provider.PatchMemory(Address, Convert.ToInt64(result.Value)); }
+                            break;
+                    }
+                    result = null;
+                    provider.CloseProvider();
                 }
-                provider.CloseProvider();
             }
         }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22