Class HarmonyMethod
- Namespace
- HarmonyLib
- Assembly
- 0Harmony.dll
A wrapper around a method to use it as a patch (for example a Prefix)
public class HarmonyMethod
- Inheritance
-
objectHarmonyMethod
- Extension Methods
Constructors
HarmonyMethod()
Default constructor
public HarmonyMethod()
HarmonyMethod(Delegate)
Creates a patch from a given method
public HarmonyMethod(Delegate @delegate)
Parameters
delegateDelegateThe original method
HarmonyMethod(Delegate, int, string[], string[], bool?)
Creates a patch from a given method
public HarmonyMethod(Delegate @delegate, int priority = -1, string[] before = null, string[] after = null, bool? debug = null)
Parameters
delegateDelegateThe original method
priorityintThe patch Priority
beforestring[]A list of harmony IDs that should come after this patch
afterstring[]A list of harmony IDs that should come before this patch
debugbool?Set to true to generate debug output
HarmonyMethod(MethodInfo)
Creates a patch from a given method
public HarmonyMethod(MethodInfo method)
Parameters
methodMethodInfoThe original method
HarmonyMethod(MethodInfo, int, string[], string[], bool?)
Creates a patch from a given method
public HarmonyMethod(MethodInfo method, int priority = -1, string[] before = null, string[] after = null, bool? debug = null)
Parameters
methodMethodInfoThe original method
priorityintThe patch Priority
beforestring[]A list of harmony IDs that should come after this patch
afterstring[]A list of harmony IDs that should come before this patch
debugbool?Set to true to generate debug output
HarmonyMethod(Type, string, Type[])
Creates a patch from a given method
public HarmonyMethod(Type methodType, string methodName, Type[] argumentTypes = null)
Parameters
methodTypeTypeThe patch class/type
methodNamestringThe patch method name
argumentTypesType[]The optional argument types of the patch method (for overloaded methods)
Fields
after
Install this patch after patches with these Harmony IDs
public string[] after
Field Value
- string[]
argumentTypes
Array of argument types of the patch method
public Type[] argumentTypes
Field Value
- Type[]
before
Install this patch before patches with these Harmony IDs
public string[] before
Field Value
- string[]
category
Patch Category
public string category
Field Value
- string
debug
Create debug output for this patch
public bool? debug
Field Value
- bool?
declaringType
Class/type declaring this patch
public Type declaringType
Field Value
- Type
infixOuterBody
The body searched by an Infix; null keeps the declared method
public InfixOuterBody? infixOuterBody
Field Value
innerMethod
The Infix call selector
public InnerMethod innerMethod
Field Value
innerTarget
The Infix member-operation or literal selector
public InnerTarget innerTarget
Field Value
method
The original method
public MethodInfo method
Field Value
- MethodInfo
methodName
Patch method name
public string methodName
Field Value
- string
methodType
Optional patch MethodType
public MethodType? methodType
Field Value
nonVirtualDelegate
Whether to use Call (true) or VirtualCall (false) mechanics
for HarmonyDelegate-attributed delegate
public bool nonVirtualDelegate
Field Value
- bool
priority
Priority of the patch
public int priority
Field Value
- int
reversePatchType
Reverse patch type, see HarmonyReversePatchType
public HarmonyReversePatchType? reversePatchType
Field Value
Methods
HarmonyFields()
Gets the names of all internal patch info fields
public static List<string> HarmonyFields()
Returns
- List<string>
A list of field names
Merge(List<HarmonyMethod>)
Merges annotations
public static HarmonyMethod Merge(List<HarmonyMethod> attributes)
Parameters
attributesList<HarmonyMethod>The list of HarmonyMethod to merge
Returns
- HarmonyMethod
The merged HarmonyMethod
ToString()
Returns a string that represents the annotation
public override string ToString()
Returns
- string
A string representation
Operators
implicit operator HarmonyMethod(Delegate)
Creates a patch from a given method
public static implicit operator HarmonyMethod(Delegate @delegate)
Parameters
delegateDelegateThe original method
Returns
implicit operator HarmonyMethod(MethodInfo)
Creates a patch from a given method
public static implicit operator HarmonyMethod(MethodInfo method)
Parameters
methodMethodInfoThe original method