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

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

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

--- trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs	2012/06/03 14:50:09	245
+++ trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs	2012/06/20 12:16:34	398
@@ -63,31 +63,33 @@
         }
         private void btnOK_Click(object sender, EventArgs e)
         {
-            GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this);
-            provider.OpenProvider();
-            foreach(ResultDataType patch in PatchList)
+            using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
             {
-                switch (patch.ValueType)
+                provider.OpenProvider();
+                foreach (ResultDataType patch in PatchList)
                 {
-                    case SearchDataTypes._8bits:
-                        if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (byte)txtValue.Value); }
-                        else { provider.PatchMemory(patch.Address, (sbyte)txtValue.Value); }
-                        break;
-                    case SearchDataTypes._16bits:
-                        if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (ushort)txtValue.Value); }
-                        else { provider.PatchMemory(patch.Address, (short)txtValue.Value); }
-                        break;
-                    case SearchDataTypes._32bits:
-                        if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (uint)txtValue.Value); }
-                        else { provider.PatchMemory(patch.Address, (int)txtValue.Value); }
-                        break;
-                    case SearchDataTypes._64bits:
-                        if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (ulong)txtValue.Value); }
-                        else { provider.PatchMemory(patch.Address, (long)txtValue.Value); }
-                        break;
+                    switch (patch.ValueType)
+                    {
+                        case SearchDataTypes._8bits:
+                            if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (byte)txtValue.Value); }
+                            else { provider.PatchMemory(patch.Address, (sbyte)txtValue.Value); }
+                            break;
+                        case SearchDataTypes._16bits:
+                            if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (ushort)txtValue.Value); }
+                            else { provider.PatchMemory(patch.Address, (short)txtValue.Value); }
+                            break;
+                        case SearchDataTypes._32bits:
+                            if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (uint)txtValue.Value); }
+                            else { provider.PatchMemory(patch.Address, (int)txtValue.Value); }
+                            break;
+                        case SearchDataTypes._64bits:
+                            if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (ulong)txtValue.Value); }
+                            else { provider.PatchMemory(patch.Address, (long)txtValue.Value); }
+                            break;
+                    }
                 }
+                provider.CloseProvider();
             }
-            provider.CloseProvider();
             this.Close();
         }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22