public void Unpatch(HarmonyPatchType type, string harmonyID) { lock (locker) { foreach (var original in originals) { var patchInfo = HarmonySharedState.GetPatchInfo(original); if (patchInfo == null) { patchInfo = new PatchInfo(); } if (type == HarmonyPatchType.All || type == HarmonyPatchType.Prefix) { PatchFunctions.RemovePrefix(patchInfo, harmonyID); } if (type == HarmonyPatchType.All || type == HarmonyPatchType.Postfix) { PatchFunctions.RemovePostfix(patchInfo, harmonyID); } if (type == HarmonyPatchType.All || type == HarmonyPatchType.Transpiler) { PatchFunctions.RemoveTranspiler(patchInfo, harmonyID); } PatchFunctions.UpdateWrapper(original, patchInfo, instance.Id); HarmonySharedState.UpdatePatchInfo(original, patchInfo); } } }
/// <summary>Unpatches a method</summary> /// <param name="original">The original method</param> /// <param name="type">The patch type</param> /// <param name="harmonyID">The optional Harmony ID to restrict unpatching to a specific instance</param> /// public void Unpatch(MethodBase original, HarmonyPatchType type, string harmonyID = null) { var processor = new PatchProcessor(this, new List <MethodBase> { original }); processor.Unpatch(type, harmonyID); }
internal static HarmonyLib.HarmonyPatchType ToHarmony20(this HarmonyPatchType type) { return((HarmonyLib.HarmonyPatchType)type); }
public void Unpatch(HarmonyPatchType type, string harmonyID) { patchProcessors.Do(p => p.Unpatch(type.ToHarmony20(), harmonyID)); }
public void Unpatch(MethodBase original, HarmonyPatchType type, string harmonyID = null) => Unpatch(original, (HarmonyLib.HarmonyPatchType)type, harmonyID);