/[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/19 07:56:36	378
+++ trunk/RomCheater/Docking/MemorySearch/SearchPatcher.cs	2012/06/20 12:16:34	398
@@ -108,28 +108,30 @@
         {
             uint Address = txtAddress.ToUInt32();
 
-            GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this);
-            provider.OpenProvider();
-            switch (DataType)
+            using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
             {
-                case SearchDataTypes._8bits:
-                    if (Unsigned) { provider.PatchMemory(Address, txtValue.ToByte()); }
-                    else { provider.PatchMemory(Address, txtValue.ToSByte()); }
-                    break;
-                case SearchDataTypes._16bits:
-                    if (Unsigned) { provider.PatchMemory(Address, txtValue.ToUInt16()); }
-                    else { provider.PatchMemory(Address, txtValue.ToInt16()); }
-                    break;
-                case SearchDataTypes._32bits:
-                    if (Unsigned) { provider.PatchMemory(Address, txtValue.ToUInt32()); }
-                    else { provider.PatchMemory(Address, txtValue.ToInt32()); }
-                    break;
-                case SearchDataTypes._64bits:
-                    if (Unsigned) { provider.PatchMemory(Address, txtValue.ToUInt64()); }
-                    else { provider.PatchMemory(Address, txtValue.ToInt64()); }
-                    break;
+                provider.OpenProvider();
+                switch (DataType)
+                {
+                    case SearchDataTypes._8bits:
+                        if (Unsigned) { provider.PatchMemory(Address, txtValue.ToByte()); }
+                        else { provider.PatchMemory(Address, txtValue.ToSByte()); }
+                        break;
+                    case SearchDataTypes._16bits:
+                        if (Unsigned) { provider.PatchMemory(Address, txtValue.ToUInt16()); }
+                        else { provider.PatchMemory(Address, txtValue.ToInt16()); }
+                        break;
+                    case SearchDataTypes._32bits:
+                        if (Unsigned) { provider.PatchMemory(Address, txtValue.ToUInt32()); }
+                        else { provider.PatchMemory(Address, txtValue.ToInt32()); }
+                        break;
+                    case SearchDataTypes._64bits:
+                        if (Unsigned) { provider.PatchMemory(Address, txtValue.ToUInt64()); }
+                        else { provider.PatchMemory(Address, txtValue.ToInt64()); }
+                        break;
+                }
+                provider.CloseProvider();
             }
-            provider.CloseProvider();
             this.Close();
         }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22