Table of Contents

Class Monkey<TMonkey>

Namespace
MonkeyLoader.Patching
Assembly
MonkeyLoader.dll

Represents the base class for patchers that run after a game's assemblies have been loaded.
All mod defined derivatives must derive from Monkey<TMonkey>, ConfiguredMonkey<TMonkey, TConfigSection>, or another class derived from it.

public abstract class Monkey<TMonkey> : MonkeyBase<TMonkey>, IMonkey, IRun, IShutdown, IComparable<IMonkey>, INestedIdentifiable<Mod>, INestedIdentifiable, IIdentifiable, IAuthorable where TMonkey : Monkey<TMonkey>, new()

Type Parameters

TMonkey

The type of the actual patcher.

Inheritance
MonkeyBase<TMonkey>
Monkey<TMonkey>
Implements
Derived
ConfiguredMonkey<TMonkey, TConfigSection>
Inherited Members
Extension Methods

Remarks

Game assemblies and their types can be directly referenced from these.

Constructors

Monkey()

Allows creating only a single TMonkey instance.

protected Monkey()

Exceptions

InvalidOperationException

When the concrete Type isn't TMonkey; or when there's already an Instance.

Methods

LogPatches()

Debug-logs the Harmony patches of this patcher.

protected void LogPatches()

OnLoaded()

Called right after the game tooling packs and all the game's assemblies have been loaded.
Use this to apply any patching and return true if it was successful.

protected virtual bool OnLoaded()

Returns

bool

true if it ran successfully; otherwise, false.

Remarks

By default: Applies the HarmonyLib.Harmony patches of the category with this patcher's type's name.
Easy to apply by using [HarmonyLib.HarmonyPatchCategory(nameof(MyPatcher))] attribute.

Run()

Runs this monkey to let it patch.
Must only be called once.

public override sealed bool Run()

Returns

bool

true if it ran successfully; otherwise, false.

Exceptions

InvalidOperationException

If it gets called more than once.