Class HarmonyMethod
A wrapper around a method to use it as a patch (for example a Prefix)
Inheritance
Namespace: HarmonyLib
Assembly: 0Harmony.dll
Syntax
public class HarmonyMethod
Constructors
| Improve this Doc View SourceHarmonyMethod()
Default constructor
Declaration
public HarmonyMethod()
HarmonyMethod(Delegate)
Creates a patch from a given method
Declaration
public HarmonyMethod(Delegate delegate)
Parameters
Type | Name | Description |
---|---|---|
System.Delegate | delegate | The original method |
HarmonyMethod(Delegate, Int32, String[], String[], Nullable<Boolean>)
Creates a patch from a given method
Declaration
public HarmonyMethod(Delegate delegate, int priority = -1, string[] before = null, string[] after = null, bool? debug = null)
Parameters
Type | Name | Description |
---|---|---|
System.Delegate | delegate | The original method |
System.Int32 | priority | The patch Priority |
System.String[] | before | A list of harmony IDs that should come after this patch |
System.String[] | after | A list of harmony IDs that should come before this patch |
System.Nullable<System.Boolean> | debug | Set to true to generate debug output |
HarmonyMethod(MethodInfo)
Creates a patch from a given method
Declaration
public HarmonyMethod(MethodInfo method)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | method | The original method |
HarmonyMethod(MethodInfo, Int32, String[], String[], Nullable<Boolean>)
Creates a patch from a given method
Declaration
public HarmonyMethod(MethodInfo method, int priority = -1, string[] before = null, string[] after = null, bool? debug = null)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | method | The original method |
System.Int32 | priority | The patch Priority |
System.String[] | before | A list of harmony IDs that should come after this patch |
System.String[] | after | A list of harmony IDs that should come before this patch |
System.Nullable<System.Boolean> | debug | Set to true to generate debug output |
HarmonyMethod(Type, String, Type[])
Creates a patch from a given method
Declaration
public HarmonyMethod(Type methodType, string methodName, Type[] argumentTypes = null)
Parameters
Type | Name | Description |
---|---|---|
System.Type | methodType | The patch class/type |
System.String | methodName | The patch method name |
System.Type[] | argumentTypes | The optional argument types of the patch method (for overloaded methods) |
Fields
| Improve this Doc View Sourceafter
Install this patch after patches with these Harmony IDs
Declaration
public string[] after
Field Value
Type | Description |
---|---|
System.String[] |
argumentTypes
Array of argument types of the patch method
Declaration
public Type[] argumentTypes
Field Value
Type | Description |
---|---|
System.Type[] |
before
Install this patch before patches with these Harmony IDs
Declaration
public string[] before
Field Value
Type | Description |
---|---|
System.String[] |
category
Patch Category
Declaration
public string category
Field Value
Type | Description |
---|---|
System.String |
debug
Create debug output for this patch
Declaration
public bool? debug
Field Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
declaringType
Class/type declaring this patch
Declaration
public Type declaringType
Field Value
Type | Description |
---|---|
System.Type |
method
The original method
Declaration
public MethodInfo method
Field Value
Type | Description |
---|---|
System.Reflection.MethodInfo |
methodName
Patch method name
Declaration
public string methodName
Field Value
Type | Description |
---|---|
System.String |
methodType
Optional patch MethodType
Declaration
public MethodType? methodType
Field Value
Type | Description |
---|---|
System.Nullable<MethodType> |
nonVirtualDelegate
Whether to use Call (true
) or VirtualCall (false
) mechanics
for HarmonyDelegate-attributed delegate
Declaration
public bool nonVirtualDelegate
Field Value
Type | Description |
---|---|
System.Boolean |
priority
Priority of the patch
Declaration
public int priority
Field Value
Type | Description |
---|---|
System.Int32 |
reversePatchType
Reverse patch type, see HarmonyReversePatchType
Declaration
public HarmonyReversePatchType? reversePatchType
Field Value
Type | Description |
---|---|
System.Nullable<HarmonyReversePatchType> |
Methods
| Improve this Doc View SourceHarmonyFields()
Gets the names of all internal patch info fields
Declaration
public static List<string> HarmonyFields()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | A list of field names |
Merge(List<HarmonyMethod>)
Merges annotations
Declaration
public static HarmonyMethod Merge(List<HarmonyMethod> attributes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<HarmonyMethod> | attributes | The list of HarmonyMethod to merge |
Returns
Type | Description |
---|---|
HarmonyMethod | The merged HarmonyMethod |
ToString()
Returns a string that represents the annotation
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representation |
Overrides
Operators
| Improve this Doc View SourceImplicit(Delegate to HarmonyMethod)
Creates a patch from a given method
Declaration
public static implicit operator HarmonyMethod(Delegate delegate)
Parameters
Type | Name | Description |
---|---|---|
System.Delegate | delegate | The original method |
Returns
Type | Description |
---|---|
HarmonyMethod |
Implicit(MethodInfo to HarmonyMethod)
Creates a patch from a given method
Declaration
public static implicit operator HarmonyMethod(MethodInfo method)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | method | The original method |
Returns
Type | Description |
---|---|
HarmonyMethod |