Class Patch
- Namespace
- HarmonyLib
- Assembly
- 0Harmony.dll
A serializable patch
public class Patch
- Inheritance
-
objectPatch
Constructors
Patch(HarmonyMethod, int, string)
Creates a patch
public Patch(HarmonyMethod method, int index, string owner)
Parameters
methodHarmonyMethodThe method of the patch
indexintZero-based index
ownerstringAn owner (Harmony ID)
Patch(MethodInfo, int, string, int, string[], string[], bool)
Creates a patch
public Patch(MethodInfo patch, int index, string owner, int priority, string[] before, string[] after, bool debug)
Parameters
patchMethodInfoThe method of the patch
indexintZero-based index
ownerstringAn owner (Harmony ID)
priorityintThe priority, see Priority
beforestring[]A list of Harmony IDs for patches that should run after this patch
afterstring[]A list of Harmony IDs for patches that should run before this patch
debugboolA 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
public readonly string[] after
Field Value
- string[]
before
Keep this patch before the patches indicated in the list of Harmony IDs
public readonly string[] before
Field Value
- 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
public readonly bool debug
Field Value
- bool
index
Zero-based index
public readonly int index
Field Value
- int
innerMethod
For an infix patch, this defines the inner method that we will apply the patch to
[OptionalField]
public readonly InnerMethod innerMethod
Field Value
innerTarget
The selected extended operation; method-call patches retain their existing innerMethod representation
[OptionalField]
public readonly InnerTarget innerTarget
Field Value
owner
The owner (Harmony ID)
public readonly string owner
Field Value
- string
priority
The priority, see Priority
public readonly int priority
Field Value
- int
Properties
PatchMethod
The method of the static patch method
public MethodInfo PatchMethod { get; set; }
Property Value
- MethodInfo
Methods
CompareTo(object)
Determines how patches sort
public int CompareTo(object obj)
Parameters
objobjectThe other patch
Returns
- int
integer to define sort order (-1, 0, 1)
Equals(object)
Determines whether patches have the same callback. Infix records compare stored module and method identity, without resolving the callback, and are distinct from ordinary patch records. Owners and selectors are not compared.
public override bool Equals(object obj)
Parameters
objobjectThe other patch
Returns
- bool
true if equal
GetHashCode()
Hash function
public override int GetHashCode()
Returns
- int
A hash code
GetMethod(MethodBase)
Get the patch method or a DynamicMethod if original patch method is a patch factory
public MethodInfo GetMethod(MethodBase original)
Parameters
originalMethodBaseThe original method/constructor
Returns
- MethodInfo
The method of the patch