/// <summary> /// An instance capable of detouring a method to call another method /// </summary> public MethodDetour(MethodInfo originalMethod, MethodInfo targetMethod) { if (originalMethod is null || targetMethod is null) { throw new ArgumentException("One or more the parameters was invalid"); } ValidationHandler.ValidateMethodSignature(originalMethod, targetMethod); _originalMethodHandle = originalMethod.MethodHandle; _targetMethodHandle = targetMethod.MethodHandle; PrepareDetour(); }
/// <summary> /// Initialises an instance capable of detouring a function to call another function /// </summary> public MethodDetour(MethodInfo originalMethod, MethodInfo targetMethod) { if (originalMethod is null || targetMethod is null) { throw new ArgumentException("One or more the parameters was invalid"); } // Ensure the method signatures match ValidationHandler.ValidateMethodSignature(originalMethod, targetMethod); // Get the original method handle _originalMethodHandle = originalMethod.MethodHandle; // Get the target method handle _targetMethodHandle = targetMethod.MethodHandle; PrepareDetour(); }