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();
}