Esempio n. 1
0
 private void SavePatch()
 {
     GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "SavePatch", txtPatchTitle.Text);
     lblStatusBar.Text = "Saving Patch....";
     MagicPatches.Patch patch = new MagicPatches.Patch
     {
         title              = txtPatchTitle.Text,
         author             = txtPatchAuthor.Text,
         description        = txtPatchDescription.Text,
         pattern            = txtPatternBytesSearch.Text,
         match              = txtPatternMatch.Text,
         offset             = Convert.ToInt32(txtPatternOffset.Text),
         patch              = txtBytesToPatch.Text,
         recursivePatch     = chkPatchReplaceAll.Checked,
         patchOnStartup     = chkRunOnStartup.Checked,
         patchBeforeStartup = chkPatchBeforeStartup.Checked
     };
     if (patches.PatchList.ElementAtOrDefault(listPatches.SelectedIndex) != null)
     {
         patches.PatchList.RemoveAt(listPatches.SelectedIndex);
     }
     patches.PatchList.Add(patch);
     lastSelected = txtPatchTitle.Text;
     WritePatchesToDisk();
 }
Esempio n. 2
0
 private void TestPatchWrite()
 {
     if (listPatternResults.Items.Count > 0)
     {
         MagicPatches.Patch tmpPatch = new MagicPatches.Patch
         {
             title              = txtPatchTitle.Text,
             author             = txtPatchAuthor.Text,
             description        = txtPatchDescription.Text,
             pattern            = txtPatternBytesSearch.Text,
             match              = txtPatternMatch.Text,
             offset             = Convert.ToInt32(txtPatternOffset.Text),
             patch              = txtBytesToPatch.Text,
             recursivePatch     = chkPatchReplaceAll.Checked,
             patchOnStartup     = chkRunOnStartup.Checked,
             patchBeforeStartup = chkPatchBeforeStartup.Checked
         };
         if (tmpPatch.recursivePatch)
         {
             if (MagicPatches.PatchRecursive(tmpPatch))
             {
                 GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "TestPatchWrite", "Patch Successful");
                 MessageBox.Show("Patch Successful");
             }
             else
             {
                 GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "TestPatchWrite", "Patch Failed.");
                 MessageBox.Show("Patch Failed.");
             }
         }
         else
         {
             this.Invoke((MethodInvoker) delegate()
             {
                 if (listPatternResults.SelectedItems.Count > 0)
                 {
                     string item         = listPatternResults.SelectedItems[0].ToString();
                     CurrentPatchAddress = (IntPtr)Convert.ToInt32(item, 16);
                     MagicPatches.PatchSingleAddress(tmpPatch, CurrentPatchAddress);
                 }
                 else
                 {
                     MessageBox.Show("If you're not running a full run, you need to select an address in the patch test results.");
                 }
                 btnPatternScanStop.Enabled = false;
                 btnTestPatchWrite.Enabled  = true;
                 btnTestPatchWrite.Text     = "Test Patch";
             });
         }
     }
     else
     {
         MessageBox.Show("You need to run a pattern scan test before you can test writing.");
     }
 }
Esempio n. 3
0
        private void TestPatchWrite()
        {
            if (listPatternResults.Items.Count > 0)
            {
                MagicPatches.Patch tmpPatch = new MagicPatches.Patch
                {
                    title = txtPatchTitle.Text,
                    author = txtPatchAuthor.Text,
                    description = txtPatchDescription.Text,
                    pattern = txtPatternBytesSearch.Text,
                    match = txtPatternMatch.Text,
                    offset = Convert.ToInt32(txtPatternOffset.Text),
                    patch = txtBytesToPatch.Text,
                    recursivePatch = chkPatchReplaceAll.Checked,
                    patchOnStartup = chkRunOnStartup.Checked,
                    patchBeforeStartup = chkPatchBeforeStartup.Checked
                };
                if (tmpPatch.recursivePatch)
                {
                    if (MagicPatches.PatchRecursive(tmpPatch))
                    {
                        GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "TestPatchWrite", "Patch Successful");
                        MessageBox.Show("Patch Successful");
                    }
                    else
                    {
                        GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "TestPatchWrite", "Patch Failed.");
                        MessageBox.Show("Patch Failed.");
                    }
                }
                else
                {
                    this.Invoke((MethodInvoker)delegate()
                   {
                       if (listPatternResults.SelectedItems.Count > 0)
                       {
                           string item = listPatternResults.SelectedItems[0].ToString();
                           CurrentPatchAddress = (IntPtr)Convert.ToInt32(item, 16);
                           MagicPatches.PatchSingleAddress(tmpPatch, CurrentPatchAddress);
                       }
                       else
                       {
                           MessageBox.Show("If you're not running a full run, you need to select an address in the patch test results.");
                       }
                       btnPatternScanStop.Enabled = false;
                       btnTestPatchWrite.Enabled = true;
                       btnTestPatchWrite.Text = "Test Patch";
                   });
                }

            }
            else
            {
                MessageBox.Show("You need to run a pattern scan test before you can test writing.");
            }
        }
Esempio n. 4
0
 private void SavePatch()
 {
     GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "SavePatch", txtPatchTitle.Text);
     lblStatusBar.Text = "Saving Patch....";
     MagicPatches.Patch patch = new MagicPatches.Patch
     {
         title = txtPatchTitle.Text,
         author = txtPatchAuthor.Text,
         description = txtPatchDescription.Text,
         pattern = txtPatternBytesSearch.Text,
         match = txtPatternMatch.Text,
         offset = Convert.ToInt32(txtPatternOffset.Text),
         patch = txtBytesToPatch.Text,
         recursivePatch = chkPatchReplaceAll.Checked,
         patchOnStartup = chkRunOnStartup.Checked,
         patchBeforeStartup = chkPatchBeforeStartup.Checked
     };
     if (patches.PatchList.ElementAtOrDefault(listPatches.SelectedIndex) != null)
     {
         patches.PatchList.RemoveAt(listPatches.SelectedIndex);
     }
     patches.PatchList.Add(patch);
     lastSelected = txtPatchTitle.Text;
     WritePatchesToDisk();
 }