Skip to content

Commit 31ab10f

Browse files
committed
Bug fix and QOL changes
1 parent 0b9adb4 commit 31ab10f

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

OxidePatcher/Decompiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static string DecompileToIL(MethodBody body)
3030
for (int i = 0; i < instructions.Count; i++)
3131
{
3232
var inst = instructions[i];
33-
sb.AppendLine(inst.ToString());
33+
sb.AppendLine(inst.ToString().Replace("\n", "\\n"));
3434
}
3535
return sb.ToString();
3636
}

OxidePatcher/PatchProcessForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected override void OnLoad(EventArgs e)
3636
errors = 0;
3737

3838
foreach (var manifest in PatchProject.Manifests)
39-
progressbar.Maximum += manifest.Hooks.Count(h => h.BaseHook == null) + manifest.Modifiers.Count + 2;
39+
progressbar.Maximum += manifest.Hooks.Count(h => h.BaseHook == null || (h.BaseHook != null && h.Flagged)) + manifest.Modifiers.Count + 2;
4040

4141
thetask = new Task(Worker);
4242
thetask.Start();

OxidePatcher/Patching/ILWeaver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public override string ToString()
338338
{
339339
StringBuilder sb = new StringBuilder();
340340
for (int i = 0; i < Instructions.Count; i++)
341-
sb.AppendLine(Instructions[i].ToString());
341+
sb.AppendLine(Instructions[i].ToString().Replace("\n", "\\n"));
342342
return sb.ToString();
343343
}
344344

OxidePatcher/Views/HookViewControl.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,23 @@ protected override async void OnLoad(EventArgs e)
145145
var weaver = new ILWeaver(methoddef.Body) {Module = methoddef.Module};
146146

147147
Hook.PreparePatch(methoddef, weaver, MainForm.OxideAssembly);
148-
msilbefore = new TextEditorControl { Dock = DockStyle.Fill, Text = weaver.ToString() };
148+
msilbefore = new TextEditorControl { Dock = DockStyle.Fill, Text = weaver.ToString(), IsReadOnly = true };
149149
codebefore = new TextEditorControl
150150
{
151151
Dock = DockStyle.Fill,
152152
Text = await Decompiler.GetSourceCode(methoddef, weaver),
153-
Document = { HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("C#") }
153+
Document = { HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("C#") },
154+
IsReadOnly = true
154155
};
155156

156157
Hook.ApplyPatch(methoddef, weaver, MainForm.OxideAssembly);
157-
msilafter = new TextEditorControl { Dock = DockStyle.Fill, Text = weaver.ToString() };
158+
msilafter = new TextEditorControl { Dock = DockStyle.Fill, Text = weaver.ToString(), IsReadOnly = true };
158159
codeafter = new TextEditorControl
159160
{
160161
Dock = DockStyle.Fill,
161162
Text = await Decompiler.GetSourceCode(methoddef, weaver),
162-
Document = { HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("C#") }
163+
Document = { HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("C#") },
164+
IsReadOnly = true
163165
};
164166

165167
beforetab.Controls.Add(msilbefore);
@@ -194,6 +196,7 @@ private void unflagbutton_Click(object sender, EventArgs e)
194196
{
195197
Hook.Flagged = false;
196198
MainForm.UpdateHook(Hook, false);
199+
if (Hook.Flagged) return;
197200
flagbutton.Enabled = true;
198201
unflagbutton.Enabled = false;
199202
}

0 commit comments

Comments
 (0)