Browse documentation

Class Transpilers

Namespace
HarmonyLib
Assembly
0Harmony.dll

A collection of commonly used transpilers

public static class Transpilers
Inheritance
object
Transpilers

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

instructions IEnumerable<CodeInstruction>

The instructions to act on

text string

The 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

instructions IEnumerable<CodeInstruction>

The enumeration of CodeInstruction to act on

predicate Func<CodeInstruction, bool>

A predicate selecting the instructions to change

action Action<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

instructions IEnumerable<CodeInstruction>

The enumeration of CodeInstruction to act on

from MethodBase

Method or constructor to search for

to MethodBase

Method or constructor to replace with

Returns

IEnumerable<CodeInstruction>

Modified enumeration of CodeInstruction

Harmony 3 preview

For the stable release, read the 2.x documentation.