Class Transpilers
- Namespace
- HarmonyLib
- Assembly
- 0Harmony.dll
A collection of commonly used transpilers
public static class Transpilers
- Inheritance
-
objectTranspilers
Methods
DebugLogger(IEnumerable<CodeInstruction>, string)
A transpiler that logs a text at the beginning of the method
public static IEnumerable<CodeInstruction> DebugLogger(this IEnumerable<CodeInstruction> instructions, string text)
Parameters
instructionsIEnumerable<CodeInstruction>The instructions to act on
textstringThe log text
Returns
- IEnumerable<CodeInstruction>
Modified enumeration of CodeInstruction
Manipulator(IEnumerable<CodeInstruction>, Func<CodeInstruction, bool>, Action<CodeInstruction>)
A transpiler that alters instructions that match a predicate by calling an action
public static IEnumerable<CodeInstruction> Manipulator(this IEnumerable<CodeInstruction> instructions, Func<CodeInstruction, bool> predicate, Action<CodeInstruction> action)
Parameters
instructionsIEnumerable<CodeInstruction>The enumeration of CodeInstruction to act on
predicateFunc<CodeInstruction, bool>A predicate selecting the instructions to change
actionAction<CodeInstruction>An action to apply to matching instructions
Returns
- IEnumerable<CodeInstruction>
Modified enumeration of CodeInstruction
MethodReplacer(IEnumerable<CodeInstruction>, MethodBase, MethodBase)
A transpiler that replaces all occurrences of a given method with another one using the same signature
public static IEnumerable<CodeInstruction> MethodReplacer(this IEnumerable<CodeInstruction> instructions, MethodBase from, MethodBase to)
Parameters
instructionsIEnumerable<CodeInstruction>The enumeration of CodeInstruction to act on
fromMethodBaseMethod or constructor to search for
toMethodBaseMethod or constructor to replace with
Returns
- IEnumerable<CodeInstruction>
Modified enumeration of CodeInstruction