docs/api/HarmonyLib.HarmonyMethod.html
A wrapper around a method to use it as a patch (for example a Prefix)
System.Object
HarmonyMethod
public class HarmonyMethod
Default constructor
public HarmonyMethod()
Creates a patch from a given method
public HarmonyMethod(Delegate delegate)
| Type | Name | Description |
|---|---|---|
| System.Delegate | delegate |
The original method
|
Creates a patch from a given method
public HarmonyMethod(Delegate delegate, int priority = -1, string[] before = null, string[] after = null, bool? debug = default(bool? ))
| 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\ | debug |
Set to true to generate debug output
|
Creates a patch from a given method
public HarmonyMethod(MethodInfo method)
| Type | Name | Description |
|---|---|---|
| System.Reflection.MethodInfo | method |
The original method
|
Creates a patch from a given method
public HarmonyMethod(MethodInfo method, int priority = -1, string[] before = null, string[] after = null, bool? debug = default(bool? ))
| 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\ | debug |
Set to true to generate debug output
|
Creates a patch from a given method
public HarmonyMethod(Type methodType, string methodName, Type[] argumentTypes = null)
| 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)
|
Install this patch after patches with these Harmony IDs
public string[] after
| Type | Description |
|---|---|
| System.String[] |
Array of argument types of the patch method
public Type[] argumentTypes
| Type | Description |
|---|---|
| System.Type[] |
Install this patch before patches with these Harmony IDs
public string[] before
| Type | Description |
|---|---|
| System.String[] |
Patch Category
public string category
| Type | Description |
|---|---|
| System.String |
Create debug output for this patch
public bool? debug
| Type | Description |
|---|---|
| System.Nullable\ |
Class/type declaring this patch
public Type declaringType
| Type | Description |
|---|---|
| System.Type |
The original method
public MethodInfo method
| Type | Description |
|---|---|
| System.Reflection.MethodInfo |
Patch method name
public string methodName
| Type | Description |
|---|---|
| System.String |
Optional patch MethodType
public MethodType? methodType
| Type | Description |
|---|---|
| System.Nullable<MethodType> |
Whether to use Call (true) or VirtualCall (false) mechanics for HarmonyDelegate-attributed delegate
public bool nonVirtualDelegate
| Type | Description |
|---|---|
| System.Boolean |
Priority of the patch
public int priority
| Type | Description |
|---|---|
| System.Int32 |
Reverse patch type, see HarmonyReversePatchType
public HarmonyReversePatchType? reversePatchType
| Type | Description |
|---|---|
| System.Nullable<HarmonyReversePatchType> |
Gets the names of all internal patch info fields
public static List<string> HarmonyFields()
| Type | Description |
|---|---|
| System.Collections.Generic.List\ |
A list of field names
|
Merges annotations
public static HarmonyMethod Merge(List<HarmonyMethod> attributes)
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<HarmonyMethod> | attributes |
The list of HarmonyMethod to merge
|
| Type | Description |
|---|---|
| HarmonyMethod |
The merged HarmonyMethod
|
Returns a string that represents the annotation
public override string ToString()
| Type | Description |
|---|---|
| System.String |
A string representation
|
System.Object.ToString()
Creates a patch from a given method
public static implicit operator HarmonyMethod(Delegate delegate)
| Type | Name | Description |
|---|---|---|
| System.Delegate | delegate |
The original method
|
| Type | Description |
|---|---|
| HarmonyMethod |
Creates a patch from a given method
public static implicit operator HarmonyMethod(MethodInfo method)
| Type | Name | Description |
|---|---|---|
| System.Reflection.MethodInfo | method |
The original method
|
| Type | Description |
|---|---|
| HarmonyMethod |
HarmonyMethodExtensions.CopyTo(HarmonyMethod, HarmonyMethod)