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
-
objectAttributeHarmonyInfix
- Inherited Members
Constructors
HarmonyInfix(object)
Selects a non-null string, int, long, float, or double literal load
public HarmonyInfix(object constant)
Parameters
constantobjectThe 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
declaringTypeTypeThe constructed type
kindInnerTargetKindConstructor
argumentTypesType[]The constructor parameter types
HarmonyInfix(Type, string)
Selects an unambiguous named method
public HarmonyInfix(Type declaringType, string methodName)
Parameters
declaringTypeTypeThe method's declaring type
methodNamestringThe method name
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
declaringTypeTypeThe member's declaring type
memberNamestringThe member name
kindInnerTargetKindMethod, Getter, Setter, FieldRead, or FieldWrite
argumentTypesType[]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
declaringTypeTypeThe method's declaring type
methodNamestringThe method name
argumentTypesType[]The method parameter types
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
declaringTypeTypeThe method's declaring type
methodNamestringThe method name
argumentTypesType[]The method parameter types
argumentVariationsArgumentType[]One ArgumentType for each argument type
Properties
OuterBody
Whether to search the selected method or its recognized state-machine body
public InfixOuterBody OuterBody { get; set; }
Property Value
Remarks
Auto leaves ordinary methods unchanged. It selects one body, not lambdas, local functions or other helper methods. Use StateMachineMoveNext(MethodBase) to find that body for GetPatchInfo(MethodBase) or unpatching.
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.