Show / Hide Table of Contents

Struct HarmonyPatcher

Uses the HarmonyX library for patching any methods/properties you like.

Should only be used if necessary

Namespace: WeaverCore
Assembly: WeaverCore.dll
Syntax
public struct HarmonyPatcher

Methods

| Edit this page View Source

Create(string)

Creates a new HarmonyPatcher

Declaration
public static HarmonyPatcher Create(string id)
Parameters
Type Name Description
string id

The id to create it with

Returns
Type Description
HarmonyPatcher

Returns the newly created Harmony Patcher. Use the Patch(MethodBase, MethodInfo, MethodInfo) method to start patching methods

| Edit this page View Source

Equals(object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool
Overrides
ValueType.Equals(object)
| Edit this page View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
int
Overrides
ValueType.GetHashCode()
| Edit this page View Source

Patch(MethodBase, MethodInfo, MethodInfo)

Patches a method with a prefix and postfix. The prefix is called before the original is called, and the postfix is called after the original method is called

Declaration
public void Patch(MethodBase original, MethodInfo prefix, MethodInfo postfix)
Parameters
Type Name Description
MethodBase original

The original method to patch

MethodInfo prefix

The prefix method. The prefix MUST be static and return a boolean value. The returned boolean determines whether the original method should be run or not. If no prefix method is needed, this can be null

MethodInfo postfix

The postfix method. The postfix MUST be static and return void. If no postfix is needed, this can be null

Exceptions
Type Condition
Exception
ArgumentNullException

Throws if the original method is null

| Edit this page View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
ValueType.ToString()

Operators

| Edit this page View Source

operator ==(HarmonyPatcher, HarmonyPatcher)

Declaration
public static bool operator ==(HarmonyPatcher left, HarmonyPatcher right)
Parameters
Type Name Description
HarmonyPatcher left
HarmonyPatcher right
Returns
Type Description
bool
| Edit this page View Source

operator !=(HarmonyPatcher, HarmonyPatcher)

Declaration
public static bool operator !=(HarmonyPatcher left, HarmonyPatcher right)
Parameters
Type Name Description
HarmonyPatcher left
HarmonyPatcher right
Returns
Type Description
bool

Extension Methods

ReflectionUtilities.ReflectCallMethod(object, string, object[], BindingFlags)
ReflectionUtilities.ReflectGetField(object, string, BindingFlags)
ReflectionUtilities.ReflectGetMethod(object, string, BindingFlags)
ReflectionUtilities.ReflectGetProperty(object, string, BindingFlags)
ReflectionUtilities.ReflectSetField(object, string, object, BindingFlags)
ReflectionUtilities.ReflectSetProperty(object, string, object, BindingFlags)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾