Class Patch
A serializable patch
Inheritance
Namespace: HarmonyLib
Assembly: 0Harmony.dll
Syntax
[Serializable]
public class Patch : IComparable
Constructors
| Improve this Doc View SourcePatch(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) |
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 Sourceafter
Keep this patch after the patches indicated in the list of Harmony IDs
Declaration
public readonly string[] after
Field Value
Type | Description |
---|---|
System.String[] |
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[] |
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 |
index
Zero-based index
Declaration
public readonly int index
Field Value
Type | Description |
---|---|
System.Int32 |
owner
The owner (Harmony ID)
Declaration
public readonly string owner
Field Value
Type | Description |
---|---|
System.String |
priority
The priority, see Priority
Declaration
public readonly int priority
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
| Improve this Doc View SourcePatchMethod
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 SourceCompareTo(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) |
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
GetHashCode()
Hash function
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code |
Overrides
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 |