C# Class Mono.Cecil.Inject.MethodDefinitionExtensions

Extensions to MethodDefinition.
ファイルを表示 Open project: denikson/Mono.Cecil.Inject

Public Methods

Method Description
GetInjector ( this target, TypeDefinition injectionType, string name, InjectFlags flags = InjectFlags.None, int localsID = null ) : InjectionDefinition

Finds a method that could be used as an injection method (hook) for this method and constructs an instance of InjectionDefinition from it.

InjectWith ( this method, MethodDefinition injectionMethod, int codeOffset, int tag, InjectFlags flags = InjectFlags.None, InjectDirection dir = InjectDirection.Before, int localsID = null, FieldDefinition typeFields = null ) : void

Inject a hook call into this method.

Method Details

GetInjector() public static method

Finds a method that could be used as an injection method (hook) for this method and constructs an instance of InjectionDefinition from it.
public static GetInjector ( this target, TypeDefinition injectionType, string name, InjectFlags flags = InjectFlags.None, int localsID = null ) : InjectionDefinition
target this This method that is used as a target.
injectionType TypeDefinition Type that contains the injection method (hook).
name string Name of the injection method (hook).
flags InjectFlags /// Injection flags that specify what values to pass to the injection method and how to inject it. This /// method attempts to find the hook method that satisfies all the specified flags. ///
localsID int /// An array of indicies of local variables to pass to the injection method. Used only if /// is specified, otherwise ignored. ///
return InjectionDefinition

InjectWith() public static method

Inject a hook call into this method.
public static InjectWith ( this method, MethodDefinition injectionMethod, int codeOffset, int tag, InjectFlags flags = InjectFlags.None, InjectDirection dir = InjectDirection.Before, int localsID = null, FieldDefinition typeFields = null ) : void
method this This method that is used as a target.
injectionMethod MethodDefinition The method the call of which to inject.
codeOffset int /// The index of the instruction from which to start injecting. If positive, will count from the /// beginning of the method. If negative, will count from the end. For instance, -1 is the method's last instruction /// and 0 is the first. ///
tag int /// If is specified, the value of this parameter will be passed as a /// parameter to the injection method. ///
flags InjectFlags Injection flags that specify what values to pass to the injection method and how to inject it.
dir InjectDirection The direction in which to insert the call: either above the start code or below it.
localsID int /// An array of indicies of local variables to pass to the injection method. Used only if /// is specified, otherwise ignored. ///
typeFields FieldDefinition /// An array of class fields from the type the target lies in to pass to the injection method. /// Used only if is specified, otherwise ignored. ///
return void