MonoDetourHook Class
Definition
Section titled “Definition”A MonoDetour Hook.
public class MonoDetourHook : IMonoDetourHook, IReadOnlyMonoDetourHook, IDisposableInheritance object
Implements IMonoDetourHook, IReadOnlyMonoDetourHook, IDisposable
Properties
Section titled “Properties”Target
Section titled “Target”The method to hook.
public MethodBase Target { get; }Manipulator
Section titled “Manipulator”The hook or manipulator method.
public MethodBase Manipulator { get; }Remarks
Section titled “Remarks”This differs from Applier’s MonoMod.RuntimeDetour.ILHook.Manipulator, as that points to the Applier itself.
ManipulatorDelegate
Section titled “ManipulatorDelegate”A delegate of Manipulator; the hook or manipulator method.
Not null if the MonoDetourHook was passed a Delegate instead of a MethodBase during construction.
public Delegate? ManipulatorDelegate { get; }The owner MonoDetourManager of this hook.
public MonoDetourManager Owner { get; }Config
Section titled “Config”Priority configuration for a MonoDetour Hook.
public MonoDetourConfig? Config { get; }Applier
Section titled “Applier”The MonoMod.RuntimeDetour.ILHook that applies the Manipulator method.
An applier comes from a class implementing IMonoDetourHookApplier.
public ILHook Applier { get; }ApplierType
Section titled “ApplierType”The IMonoDetourHookApplier type which defines how this MonoDetourHook is applied to the target method.
public Type ApplierType { get; }IsValid
Section titled “IsValid”Gets whether or not this hook is valid and can be used.
public bool IsValid { get; }IsApplied
Section titled “IsApplied”Gets whether or not this hook is applied.
public bool IsApplied { get; }Methods
Section titled “Methods”Create<TApplier>(MethodBase, Delegate, MonoDetourManager, MonoDetourConfig?, bool)
Section titled “Create<TApplier>(MethodBase, Delegate, MonoDetourManager, MonoDetourConfig?, bool)”Constructs a MonoDetourHook with Applier defined by TApplier.
public static MonoDetourHook Create<TApplier>(MethodBase target, Delegate manipulator, MonoDetourManager owner, MonoDetourConfig? config = null, bool applyByDefault = true) where TApplier : class, IMonoDetourHookApplierParameters
Section titled “Parameters”target MethodBase
The method to hook.
manipulator Delegate
The hook or manipulator method.
owner MonoDetourManager
The owner of this hook.
config MonoDetourConfig
The config which defines how to apply and treat this hook.
applyByDefault bool
Whether or not the hook should be applied after it has been constructed.
Returns
Section titled “Returns”MonoDetourHook
A new MonoDetourHook.
Create<TApplier>(MethodBase, MethodBase, MonoDetourManager, MonoDetourConfig?, bool)
Section titled “Create<TApplier>(MethodBase, MethodBase, MonoDetourManager, MonoDetourConfig?, bool)”Constructs a MonoDetourHook with Applier defined by TApplier.
public static MonoDetourHook Create<TApplier>(MethodBase target, MethodBase manipulator, MonoDetourManager owner, MonoDetourConfig? config = null, bool applyByDefault = true) where TApplier : class, IMonoDetourHookApplierParameters
Section titled “Parameters”target MethodBase
The method to hook.
manipulator MethodBase
The hook or manipulator method.
owner MonoDetourManager
The owner of this hook.
config MonoDetourConfig
The config which defines how to apply and treat this hook.
applyByDefault bool
Whether or not the hook should be applied after it has been constructed.
Returns
Section titled “Returns”MonoDetourHook
A new MonoDetourHook.
TryGetFrom(Manipulator, out MonoDetourHook?)
Section titled “TryGetFrom(Manipulator, out MonoDetourHook?)”Tries to get the corresponding MonoDetourHook for the specified MonoMod.Cil.ILContext.Manipulator if it exists.
public static bool TryGetFrom(ILContext.Manipulator key, out MonoDetourHook? monoDetourHook)Parameters
Section titled “Parameters”key MonoMod.Cil.ILContext.Manipulator
The MonoMod.Cil.ILContext.Manipulator whose MonoDetourHook to get.
monoDetourHook MonoDetourHook
The found MonoDetourHook or null.
Returns
Section titled “Returns”bool
true if the corresponding MonoDetourHook was found; otherwise, false.
Apply()
Section titled “Apply()”Applies the hook if it was not already applied.
public void Apply()Undo()
Section titled “Undo()”Undoes the hook if it was applied.
public void Undo()Dispose()
Section titled “Dispose()”Disposes the Applier hook, disposing this MonoDetourHook.
public void Dispose()