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

| Improve this Doc View Source

ApplyInfixes(IEnumerable<CodeInstruction>, MethodBase, InnerFix[])

Applies all infixes to a method

Declaration
public static IEnumerable<CodeInstruction> ApplyInfixes(this IEnumerable<CodeInstruction> instructions, MethodBase original, params InnerFix[] infixes)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CodeInstruction> instructions

The instructions of the method

System.Reflection.MethodBase original

The target method that gets the infixes applied to

InnerFix[] infixes

A list of infixes

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

The new instructions of the method

| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX