Browse documentation

Class HarmonyInfix

Namespace
HarmonyLib
Assembly
0Harmony.dll

Selects operations inside the outer patched method for an inner prefix, postfix, or finalizer

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class HarmonyInfix : HarmonyAttribute
Inheritance
object
Attribute
HarmonyInfix
Inherited Members

Constructors

HarmonyInfix(object)

Selects a non-null string, int, long, float, or double literal load

public HarmonyInfix(object constant)

Parameters

constant object

The exact literal value; its CLR type selects the corresponding IL literal category

HarmonyInfix(Type, InnerTargetKind, params Type[])

Selects newobj instructions for an instance constructor

public HarmonyInfix(Type declaringType, InnerTargetKind kind, params Type[] argumentTypes)

Parameters

declaringType Type

The constructed type

kind InnerTargetKind

Constructor

argumentTypes Type[]

The constructor parameter types

HarmonyInfix(Type, string)

Selects an unambiguous named method

public HarmonyInfix(Type declaringType, string methodName)

Parameters

declaringType Type
methodName string

HarmonyInfix(Type, string, InnerTargetKind, params Type[])

Selects a method, property accessor, or field operation

public HarmonyInfix(Type declaringType, string memberName, InnerTargetKind kind, params Type[] argumentTypes)

Parameters

declaringType Type

The member's declaring type

memberName string

The member name

kind InnerTargetKind

Method, Getter, Setter, FieldRead, or FieldWrite

argumentTypes Type[]

Method or property index parameters, excluding a setter's value; empty for fields

HarmonyInfix(Type, string, params Type[])

Selects a named method with the supplied argument types

public HarmonyInfix(Type declaringType, string methodName, params Type[] argumentTypes)

Parameters

declaringType Type
methodName string
argumentTypes Type[]

HarmonyInfix(Type, string, Type[], ArgumentType[])

Selects a named method with ref, out, or pointer argument variations

public HarmonyInfix(Type declaringType, string methodName, Type[] argumentTypes, ArgumentType[] argumentVariations)

Parameters

declaringType Type
methodName string
argumentTypes Type[]
argumentVariations ArgumentType[]

Properties

OuterBody

Whether to search the selected method or its recognized state-machine body

public InfixOuterBody OuterBody { get; set; }

Property Value

InfixOuterBody

Positions

One-based matches; negative positions count from the end, and empty selects all

public int[] Positions { get; set; }

Property Value

int[]

Remarks

Counts after transpilers, before Infix insertion. Zero, null and missing positions are invalid; at least one match is required. Installation copies the positions, so later edits do not affect installed patches.

Harmony 3 preview

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