Show / Hide Table of Contents

Class Patch

A serializable patch

Inheritance
object
Patch
Namespace: HarmonyLib
Assembly: 0Harmony.dll
Syntax
public class Patch

Constructors

Patch(HarmonyMethod, int, string)

Creates a patch

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

The method of the patch

int index

Zero-based index

string owner

An owner (Harmony ID)

Patch(MethodInfo, int, string, int, string[], string[], bool)

Creates a patch

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

The method of the patch

int index

Zero-based index

string owner

An owner (Harmony ID)

int priority

The priority, see Priority

string[] before

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

string[] after

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

bool 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

after

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

Declaration
public readonly string[] after
Field Value
Type Description
string[]

before

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

Declaration
public readonly string[] before
Field Value
Type Description
string[]

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
bool

index

Zero-based index

Declaration
public readonly int index
Field Value
Type Description
int

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

owner

The owner (Harmony ID)

Declaration
public readonly string owner
Field Value
Type Description
string

priority

The priority, see Priority

Declaration
public readonly int priority
Field Value
Type Description
int

Properties

PatchMethod

The method of the static patch method

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

Methods

CompareTo(object)

Determines how patches sort

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

The other patch

Returns
Type Description
int

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

Equals(object)

Determines whether patches are equal

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

The other patch

Returns
Type Description
bool

true if equal

Overrides
object.Equals(object)

GetHashCode()

Hash function

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code

Overrides
object.GetHashCode()

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
MethodBase original

The original method/constructor

Returns
Type Description
MethodInfo

The method of the patch

In this article
Back to top Generated by DocFX