Show / Hide Table of Contents

Class HarmonyMethod

A wrapper around a method to use it as a patch (for example a Prefix)

Inheritance
System.Object
HarmonyMethod
Namespace: HarmonyLib
Assembly: 0Harmony.dll
Syntax
public class HarmonyMethod

Constructors

| Improve this Doc View Source

HarmonyMethod()

Default constructor

Declaration
public HarmonyMethod()
| Improve this Doc View Source

HarmonyMethod(Delegate)

Creates a patch from a given method

Declaration
public HarmonyMethod(Delegate delegate)
Parameters
Type Name Description
System.Delegate delegate

The original method

| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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 Source

after

Install this patch after patches with these Harmony IDs

Declaration
public string[] after
Field Value
Type Description
System.String[]
| Improve this Doc View Source

argumentTypes

Array of argument types of the patch method

Declaration
public Type[] argumentTypes
Field Value
Type Description
System.Type[]
| Improve this Doc View Source

before

Install this patch before patches with these Harmony IDs

Declaration
public string[] before
Field Value
Type Description
System.String[]
| Improve this Doc View Source

category

Patch Category

Declaration
public string category
Field Value
Type Description
System.String
| Improve this Doc View Source

debug

Create debug output for this patch

Declaration
public bool? debug
Field Value
Type Description
System.Nullable<System.Boolean>
| Improve this Doc View Source

declaringType

Class/type declaring this patch

Declaration
public Type declaringType
Field Value
Type Description
System.Type
| Improve this Doc View Source

method

The original method

Declaration
public MethodInfo method
Field Value
Type Description
System.Reflection.MethodInfo
| Improve this Doc View Source

methodName

Patch method name

Declaration
public string methodName
Field Value
Type Description
System.String
| Improve this Doc View Source

methodType

Optional patch MethodType

Declaration
public MethodType? methodType
Field Value
Type Description
System.Nullable<MethodType>
| Improve this Doc View Source

nonVirtualDelegate

Whether to use Call (true) or VirtualCall (false) mechanics for HarmonyDelegate-attributed delegate

Declaration
public bool nonVirtualDelegate
Field Value
Type Description
System.Boolean
| Improve this Doc View Source

priority

Priority of the patch

Declaration
public int priority
Field Value
Type Description
System.Int32
| Improve this Doc View Source

reversePatchType

Reverse patch type, see HarmonyReversePatchType

Declaration
public HarmonyReversePatchType? reversePatchType
Field Value
Type Description
System.Nullable<HarmonyReversePatchType>

Methods

| Improve this Doc View Source

HarmonyFields()

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

| Improve this Doc View Source

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

| Improve this Doc View Source

ToString()

Returns a string that represents the annotation

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation

Overrides
System.Object.ToString()

Operators

| Improve this Doc View Source

Implicit(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
| Improve this Doc View Source

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

Extension Methods

HarmonyMethodExtensions.CopyTo(HarmonyMethod, HarmonyMethod)
HarmonyMethodExtensions.Clone(HarmonyMethod)
HarmonyMethodExtensions.Merge(HarmonyMethod, HarmonyMethod)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX