Show / Hide Table of Contents

Class Patch

A serializable patch

Inheritance
System.Object
Patch
Namespace: HarmonyLib
Assembly: 0Harmony.dll
Syntax
[Serializable]
public class Patch : IComparable

Constructors

| Improve this Doc View Source

Patch(HarmonyMethod, Int32, String)

Creates a patch

Declaration
public Patch(HarmonyMethod method, int index, string owner)
Parameters
Type Name Description
HarmonyMethod method

The method of the patch

System.Int32 index

Zero-based index

System.String owner

An owner (Harmony ID)

| Improve this Doc View Source

Patch(MethodInfo, Int32, String, Int32, String[], String[], Boolean)

Creates a patch

Declaration
public Patch(MethodInfo patch, int index, string owner, int priority, string[] before, string[] after, bool debug)
Parameters
Type Name Description
System.Reflection.MethodInfo patch

The method of the patch

System.Int32 index

Zero-based index

System.String owner

An owner (Harmony ID)

System.Int32 priority

The priority, see Priority

System.String[] before

A list of Harmony IDs for patches that should run after this patch

System.String[] after

A list of Harmony IDs for patches that should run before this patch

System.Boolean debug

A flag that will log the replacement method via FileLog every time this patch is used to build the replacement, even in the future

Fields

| Improve this Doc View Source

after

Keep this patch after the patches indicated in the list of Harmony IDs

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

before

Keep this patch before the patches indicated in the list of Harmony IDs

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

debug

A flag that will log the replacement method via FileLog every time this patch is used to build the replacement, even in the future

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

index

Zero-based index

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

innerMethod

For an infix patch, this defines the inner method that we will apply the patch to

Declaration
public readonly InnerMethod innerMethod
Field Value
Type Description
InnerMethod
| Improve this Doc View Source

owner

The owner (Harmony ID)

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

priority

The priority, see Priority

Declaration
public readonly int priority
Field Value
Type Description
System.Int32

Properties

| Improve this Doc View Source

PatchMethod

The method of the static patch method

Declaration
public MethodInfo PatchMethod { get; set; }
Property Value
Type Description
System.Reflection.MethodInfo

Methods

| Improve this Doc View Source

CompareTo(Object)

Determines how patches sort

Declaration
public int CompareTo(object obj)
Parameters
Type Name Description
System.Object obj

The other patch

Returns
Type Description
System.Int32

integer to define sort order (-1, 0, 1)

| Improve this Doc View Source

Equals(Object)

Determines whether patches are equal

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The other patch

Returns
Type Description
System.Boolean

true if equal

Overrides
System.Object.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Hash function

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

A hash code

Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

GetMethod(MethodBase)

Get the patch method or a DynamicMethod if original patch method is a patch factory

Declaration
public MethodInfo GetMethod(MethodBase original)
Parameters
Type Name Description
System.Reflection.MethodBase original

The original method/constructor

Returns
Type Description
System.Reflection.MethodInfo

The method of the patch

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX