Show / Hide Table of Contents

Class Transpilers

A collection of commonly used transpilers

Inheritance
object
Transpilers
Namespace: HarmonyLib
Assembly: 0Harmony.dll
Syntax
public static class Transpilers

Methods

DebugLogger(IEnumerable<CodeInstruction>, string)

A transpiler that logs a text at the beginning of the method

Declaration
public static IEnumerable<CodeInstruction> DebugLogger(this IEnumerable<CodeInstruction> instructions, string text)
Parameters
Type Name Description
IEnumerable<CodeInstruction> instructions

The instructions to act on

string text

The log text

Returns
Type Description
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

Declaration
public static IEnumerable<CodeInstruction> Manipulator(this IEnumerable<CodeInstruction> instructions, Func<CodeInstruction, bool> predicate, Action<CodeInstruction> action)
Parameters
Type Name Description
IEnumerable<CodeInstruction> instructions

The enumeration of CodeInstruction to act on

Func<CodeInstruction, bool> predicate

A predicate selecting the instructions to change

Action<CodeInstruction> action

An action to apply to matching instructions

Returns
Type Description
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

Declaration
public static IEnumerable<CodeInstruction> MethodReplacer(this IEnumerable<CodeInstruction> instructions, MethodBase from, MethodBase to)
Parameters
Type Name Description
IEnumerable<CodeInstruction> instructions

The enumeration of CodeInstruction to act on

MethodBase from

Method or constructor to search for

MethodBase to

Method or constructor to replace with

Returns
Type Description
IEnumerable<CodeInstruction>

Modified enumeration of CodeInstruction

In this article
Back to top Generated by DocFX