Skip to content

Commit 0a25b32

Browse files
committed
Show all hooks for a single method when patching
Fixes #130
1 parent 31ab10f commit 0a25b32

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

OxidePatcher/PatchProcessForm.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OxidePatcher/PatchProcessForm.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ private void WriteLog(string message)
5656
{
5757
statuslabel.Text = message;
5858
patchlog.Items.Add(message);
59+
60+
patchlog.SelectedIndex = patchlog.Items.Count - 1;
5961
}
6062

6163
private void ReportProgress(string message)
@@ -84,6 +86,8 @@ private void ReportProgress(string message)
8486
statuslabel.Text = message;
8587
patchlog.Items.Add(message);
8688
}
89+
90+
patchlog.SelectedIndex = patchlog.Items.Count - 1;
8791
}
8892

8993
private void OnWorkComplete()

OxidePatcher/Patching/Patcher.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using System.Linq;
45
using System.Reflection;
@@ -193,8 +194,23 @@ public void Patch()
193194
bool patchApplied = hook.PreparePatch(method, weaver, oxideassembly, this) && hook.ApplyPatch(method, weaver, oxideassembly, this);
194195
if (patchApplied)
195196
{
196-
Log("Applied hook {0} to {1}::{2}", hook.Name, hook.TypeName, hook.Signature.Name);
197197
weaver.Apply(method.Body);
198+
var bhook = hook;
199+
if (bhook.BaseHook != null)
200+
{
201+
var patchedHooks = new List<string> { hook.Name };
202+
while (bhook.BaseHook != null)
203+
{
204+
bhook = hook.BaseHook;
205+
patchedHooks.Add(bhook.Name);
206+
}
207+
patchedHooks.Reverse();
208+
Log("Applied hooks {0} to {1}::{2}", string.Join(", ", patchedHooks), bhook.TypeName, bhook.Signature.Name);
209+
}
210+
else
211+
{
212+
Log("Applied hook {0} to {1}::{2}", hook.Name, hook.TypeName, hook.Signature.Name);
213+
}
198214
}
199215
else
200216
{
@@ -210,6 +226,7 @@ public void Patch()
210226
}
211227
}
212228

229+
// Loop each access modifier
213230
foreach (var modifier in manifest.Modifiers)
214231
{
215232
if (modifier.Flagged)

0 commit comments

Comments
 (0)