Show / Hide Table of Contents

Class Transpilers

A collection of commonly used transpilers

Inheritance
System.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
System.Collections.Generic.IEnumerable<CodeInstruction> instructions

The instructions to act on

System.String text

The log text

Returns
Type Description
System.Collections.Generic.IEnumerable<CodeInstruction>

Modified enumeration of CodeInstruction

Manipulator(IEnumerable<CodeInstruction>, Func<CodeInstruction, Boolean>, 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
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

Returns
Type Description
System.Collections.Generic.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
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

Returns
Type Description
System.Collections.Generic.IEnumerable<CodeInstruction>

Modified enumeration of CodeInstruction

Back to top Generated by DocFX