C# Class Prism.Injector.Patcher.WrapperHelperExtensions

ファイルを表示 Open project: TerrariaPrismTeam/Prism

Public Methods

Method Description
ReplaceAllMethodRefs ( this targetRef, IMethod newRef, DNContext context, bool exitRecursion = true ) : void

Replaces all method references with the specified reference within the specified context.

ReplaceAndHook ( this toHook, MethodDef invokeHook, MethodDef realMethod, string fieldName ) : MethodDef
Wrap ( this method, DNContext context ) : void

Wraps a method using a fancy delegate. Replaces all references of the method with the wrapped one and creates an "On[MethodName]" hook which passes the method's parent type followed by the type parameters of the original method.

Wrap ( this origMethod, DNContext context, string delegateNS, string delegateTypeName, string fieldName ) : void

Wraps a method using a fancy delegate. Replaces all references of the method with the wrapped one and creates an "On[MethodName]" hook which passes the method's parent type followed by the type parameters of the original method.

Private Methods

Method Description
BuildArgTypesString ( MethodDef method ) : string
DefDelTypeName ( MethodDef method ) : string[]
GetOverloadedName ( MethodDef method ) : string
GetSafeMethodName ( string methodName ) : string

Method Details

ReplaceAllMethodRefs() public static method

Replaces all method references with the specified reference within the specified context.
public static ReplaceAllMethodRefs ( this targetRef, IMethod newRef, DNContext context, bool exitRecursion = true ) : void
targetRef this The to replace.
newRef IMethod The to replace targetRef with.
context DNContext The current .
exitRecursion bool Excludes recursive method calls from the replacement operation (may have undesired consequences with recursive methods).
return void

ReplaceAndHook() public static method

public static ReplaceAndHook ( this toHook, MethodDef invokeHook, MethodDef realMethod, string fieldName ) : MethodDef
toHook this
invokeHook MethodDef
realMethod MethodDef
fieldName string
return MethodDef

Wrap() public static method

Wraps a method using a fancy delegate. Replaces all references of the method with the wrapped one and creates an "On[MethodName]" hook which passes the method's parent type followed by the type parameters of the original method.
public static Wrap ( this method, DNContext context ) : void
method this
context DNContext The current Cecil context.
return void

Wrap() public static method

Wraps a method using a fancy delegate. Replaces all references of the method with the wrapped one and creates an "On[MethodName]" hook which passes the method's parent type followed by the type parameters of the original method.
public static Wrap ( this origMethod, DNContext context, string delegateNS, string delegateTypeName, string fieldName ) : void
origMethod this The method to wrap.
context DNContext The current Cecil context.
delegateNS string The namespace of the delegate type to create.
delegateTypeName string The name of the delegate type to create.
fieldName string
return void