From 941e464c9762f851df02fb7363890abb97f18c7e Mon Sep 17 00:00:00 2001 From: Andreas Pardeike Date: Sat, 12 Mar 2022 23:00:04 +0100 Subject: [PATCH] adds HarmonyPatch for private methods --- Harmony/Public/Attributes.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Harmony/Public/Attributes.cs b/Harmony/Public/Attributes.cs index 59ebc043..39cff1dc 100644 --- a/Harmony/Public/Attributes.cs +++ b/Harmony/Public/Attributes.cs @@ -302,6 +302,18 @@ public HarmonyPatch(Type[] argumentTypes, ArgumentType[] argumentVariations) ParseSpecialArguments(argumentTypes, argumentVariations); } + /// An annotation that specifies a method, property or constructor to patch + /// The full name of the declaring class/type + /// The name of the method, property or constructor to patch + /// The + /// + public HarmonyPatch(string typeName, string methodName, MethodType methodType = MethodType.Normal) + { + info.declaringType = AccessTools.TypeByName(typeName); + info.methodName = methodName; + info.methodType = methodType; + } + void ParseSpecialArguments(Type[] argumentTypes, ArgumentType[] argumentVariations) { if (argumentVariations is null || argumentVariations.Length == 0)