Class Hook
- Namespace
- MonoMod.RuntimeDetour
- Assembly
- MonoMod.RuntimeDetour.dll
A single method hook from a source to a target, optionally allowing the target to call the original method.
public sealed class Hook
- Inheritance
-
Hook
Remarks
Hooks, like other kinds of detours, are automatically undone when the garbage collector collects the object,
or the object is disposed. Use DetourInfo to get an object which represents the hook without
extending its lifetime.
Constructors
- Hook(Expression, Delegate)
- Constructs a Hook detouring the method specified by the provided expression tree to the provided delegate. The expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Delegate, DetourConfig?)
- Constructs a Hook detouring the method specified by the provided expression tree to the provided delegate. The expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Delegate, DetourConfig?, bool)
- Constructs a Hook detouring the method specified by the provided expression tree to the provided delegate. The expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Delegate, bool)
- Constructs a Hook detouring the method specified by the provided expression tree to the provided delegate. The expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Expression)
- Constructs a Hook using the methods specified by expression trees. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Expression, DetourConfig?)
- Constructs a Hook using the provided DetourConfig and methods specified by expression trees. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Expression, DetourConfig?, bool)
- Constructs a Hook using the provided DetourConfig and methods specified by expression trees. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Expression, bool)
- Constructs a Hook using the methods specified by expression trees. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Expression, object?)
- Constructs a Hook using the methods specified by expression trees, and specified target object. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Expression, object?, DetourConfig?)
- Constructs a Hook using the provided DetourConfig, methods specified by expression trees, and specified target object. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Expression, object?, DetourConfig?, bool)
- Constructs a Hook using the provided DetourConfig, methods specified by expression trees, and specified target object. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression, Expression, object?, bool)
- Constructs a Hook using the methods specified by expression trees, and specified target object. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Delegate)
- Constructs a Hook detouring the method specified by the provided expression tree to the provided delegate. The expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Delegate, DetourConfig?)
- Constructs a Hook detouring the method specified by the provided expression tree to the provided delegate. The expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Delegate, DetourConfig?, bool)
- Constructs a Hook detouring the method specified by the provided expression tree to the provided delegate. The expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Delegate, bool)
- Constructs a Hook detouring the method specified by the provided expression tree to the provided delegate. The expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Expression<Action>)
- Constructs a Hook using the methods specified by expression trees. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Expression<Action>, DetourConfig?)
- Constructs a Hook using the provided DetourConfig and methods specified by expression trees. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Expression<Action>, DetourConfig?, bool)
- Constructs a Hook using the provided DetourConfig and methods specified by expression trees. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Expression<Action>, bool)
- Constructs a Hook using the methods specified by expression trees. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Expression<Action>, object?)
- Constructs a Hook using the methods specified by expression trees, and specified target object. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Expression<Action>, object?, DetourConfig?)
- Constructs a Hook using the provided DetourConfig, methods specified by expression trees, and specified target object. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Expression<Action>, object?, DetourConfig?, bool)
- Constructs a Hook using the provided DetourConfig, methods specified by expression trees, and specified target object. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(Expression<Action>, Expression<Action>, object?, bool)
- Constructs a Hook using the methods specified by expression trees, and specified target object. Each expression tree must consist only of a single methodcall, which will be the method used for that parameter.
- Hook(MethodBase, Delegate)
- Constructs a Hook detouring the provided method to the provided delegate.
- Hook(MethodBase, Delegate, IDetourFactory, DetourConfig?, bool)
- Constructs a Hook detouring the provided method to the provided delegate, using the provided DetourConfig and IDetourFactory.
- Hook(MethodBase, Delegate, DetourConfig?)
- Constructs a Hook detouring the provided method to the provided delegate, using the provided DetourConfig.
- Hook(MethodBase, Delegate, DetourConfig?, bool)
- Constructs a Hook detouring the provided method to the provided delegate, using the provided DetourConfig.
- Hook(MethodBase, Delegate, bool)
- Constructs a Hook detouring the provided method to the provided delegate.
- Hook(MethodBase, MethodInfo)
- Constructs a Hook detouring
source
totarget
.
- Hook(MethodBase, MethodInfo, IDetourFactory, DetourConfig?, bool)
- Constructs a Hook detouring
source
totarget
, using the provided DetourConfig and IDetourFactory.
- Hook(MethodBase, MethodInfo, DetourConfig?)
- Constructs a Hook detouring
source
totarget
, using the provided DetourConfig.
- Hook(MethodBase, MethodInfo, DetourConfig?, bool)
- Constructs a Hook detouring
source
totarget
, using the provided DetourConfig.
- Hook(MethodBase, MethodInfo, bool)
- Constructs a Hook detouring
source
totarget
.
- Hook(MethodBase, MethodInfo, object?)
- Constructs a Hook detouring
source
totarget
, callingtarget
ontargetObj
.
- Hook(MethodBase, MethodInfo, object?, IDetourFactory, DetourConfig?, bool)
- Constructs a Hook using the specified source and target methods, specified target object, specified IDetourFactory and DetourConfig, specifying whether or not the hook should be applied when the constructor exits.
- Hook(MethodBase, MethodInfo, object?, DetourConfig?)
- Constructs a Hook detouring
source
totarget
, callingtarget
ontargetObj
, using the provided DetourConfig..
- Hook(MethodBase, MethodInfo, object?, DetourConfig?, bool)
- Constructs a Hook detouring
source
totarget
, callingtarget
ontargetObj
, using the provided DetourConfig.
- Hook(MethodBase, MethodInfo, object?, bool)
- Constructs a Hook detouring
source
totarget
, callingtarget
ontargetObj
.
Properties
- Config
- Gets the DetourConfig associated with this Hook, if any.
- DetourInfo
- Gets the DetourInfo associated with this hook.
- IsApplied
- Gets whether or not this hook is currently applied.
- IsValid
- Gets whether or not this hook is valid and can be manipulated.
- Source
- Gets the method which is being hooked.
- Target
- Gets the method which is the target of the hook.
Methods
- Apply()
- Applies this hook if it was not already applied.
- Dispose()
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ~Hook()
- Cleans up and undoes the hook, if needed.
- Undo()
- Undoes this hook if it was applied.