docs/api/HarmonyLib.Transpilers.html
A collection of commonly used transpilers
System.Object
Transpilers
public static class Transpilers
A transpiler that logs a text at the beginning of the method
public static IEnumerable<CodeInstruction> DebugLogger(this IEnumerable<CodeInstruction> instructions, string text)
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<CodeInstruction> | instructions |
The instructions to act on
| | System.String | text |
The log text
|
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<CodeInstruction> |
Modified enumeration of 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)
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<CodeInstruction> | instructions |
The enumeration of CodeInstruction to act on
| | System.Func<CodeInstruction, System.Boolean> | predicate |
A predicate selecting the instructions to change
| | System.Action<CodeInstruction> | action |
An action to apply to matching instructions
|
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<CodeInstruction> |
Modified enumeration of CodeInstruction
|
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)
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<CodeInstruction> | instructions |
The enumeration of CodeInstruction to act on
| | System.Reflection.MethodBase | from |
Method or constructor to search for
| | System.Reflection.MethodBase | to |
Method or constructor to replace with
|
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<CodeInstruction> |
Modified enumeration of CodeInstruction
|