C# Класс CitiesSkylinesDetour.RedirectionHelper

Helper class to deal with detours. This version is for Unity 5 x64 on Windows. We provide three different methods of detouring.
Показать файл Открыть проект

Открытые методы

Метод Описание
RedirectCalls ( MethodInfo from, MethodInfo to ) : void

Redirects all calls from method 'from' to method 'to'.

Приватные методы

Метод Описание
PatchJumpTo ( IntPtr site, IntPtr target ) : void

Primitive patching. Inserts a jump to 'target' at 'site'. Works even if both methods' callers have already been compiled.

RedirectCall ( MethodInfo from, MethodInfo to ) : void

Redirects all calls from method 'from' to method 'to'. This version works only if the 'from' method has already been compiled (use GetFunctionPointer to force this) but no function calling 'from' have already been compiled. In fact, this function forces compilation for 'to' and 'from'. 'to' and 'from' are assumed to be normal methods. After compilation, this method looks up the MonoJitInfo structs for both methods from domain->jit_info_hash and patches sets the pointer to native code to the code obtained from compiling 'to'.

RedirectCallIL ( MethodInfo from, MethodInfo to ) : void

Redirects calls on MSIL level. Note that this does not work over assembly boundaries, severly limiting the uses of this approach. The main problem is that IL uses tokens to identify methods. These tokens are bound to methods in the assembly metadata. In order to add calls to completely new methods (i.e. from external assemblies), one must thus edit the metadata. This method does not do this and only works for normal methods.

mono_domain_get ( ) : IntPtr
mono_method_get_header ( IntPtr method ) : IntPtr

Описание методов

RedirectCalls() публичный статический Метод

Redirects all calls from method 'from' to method 'to'.
public static RedirectCalls ( MethodInfo from, MethodInfo to ) : void
from System.Reflection.MethodInfo
to System.Reflection.MethodInfo
Результат void