public GetClassMethodReplacementProvider(IMethodBodyRewriterParameters parameters, 
     Func<ModuleDefinition, MethodReference> resolveGetProviderMethod)
 {
     _invocationInfo = parameters.InvocationInfo;
     _classMethodReplacementProvider = parameters.ClassMethodReplacementProvider;
     _resolveGetProviderMethod = resolveGetProviderMethod;
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetClassMethodReplacementProvider"/> class.
 /// </summary>
 /// <param name="parameters">The method body rewriter paramters that describe the </param>
 /// <param name="resolveGetProviderMethod">The functor that resolves the method that obtains the method replacement provider instance.</param>
 public GetClassMethodReplacementProvider(IMethodBodyRewriterParameters parameters,
                                          Func <ModuleDefinition, MethodReference> resolveGetProviderMethod)
 {
     _invocationInfo = parameters.InvocationInfo;
     _classMethodReplacementProvider = parameters.ClassMethodReplacementProvider;
     _resolveGetProviderMethod       = resolveGetProviderMethod;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddMethodReplacementImplementation"/> class.
 /// </summary>
 /// <param name="parameters">The set of parameters that describe the target method body.</param>
 public AddMethodReplacementImplementation(IMethodBodyRewriterParameters parameters)
 {
     _oldInstructions = parameters.OldInstructions;
     _interceptionDisabled = parameters.InterceptionDisabled;
     _methodReplacementProvider = parameters.MethodReplacementProvider;
     _classMethodReplacementProvider = parameters.ClassMethodReplacementProvider;
     _invocationInfo = parameters.InvocationInfo;
     _returnValue = parameters.ReturnValue;
 }
 public AddMethodReplacementImplementation(IMethodBodyRewriterParameters parameters)
 {
     _oldInstructions                = parameters.OldInstructions;
     _interceptionDisabled           = parameters.InterceptionDisabled;
     _methodReplacementProvider      = parameters.MethodReplacementProvider;
     _classMethodReplacementProvider = parameters.ClassMethodReplacementProvider;
     _invocationInfo = parameters.InvocationInfo;
     _returnValue    = parameters.ReturnValue;
 }
Beispiel #5
0
        public SurroundMethodBody(IMethodBodyRewriterParameters parameters)
        {
            _methodReplacementProvider = parameters.MethodReplacementProvider;
            _aroundInvokeProvider      = parameters.AroundInvokeProvider;
            _invocationInfo            = parameters.InvocationInfo;
            _returnValue          = parameters.ReturnValue;
            _interceptionDisabled = parameters.InterceptionDisabled;

            var getMethodReplacementProvider = new GetMethodReplacementProvider(_methodReplacementProvider, parameters.TargetMethod, parameters.GetMethodReplacementProviderMethod);

            _getMethodReplacementProvider = getMethodReplacementProvider;
            _registryType = parameters.RegistryType;
        }
        public SurroundMethodBody(IMethodBodyRewriterParameters parameters)
        {
            _methodReplacementProvider = parameters.MethodReplacementProvider;
            _aroundInvokeProvider = parameters.AroundInvokeProvider;
            _invocationInfo = parameters.InvocationInfo;
            _returnValue = parameters.ReturnValue;
            _interceptionDisabled = parameters.InterceptionDisabled;

            var getMethodReplacementProvider = new GetMethodReplacementProvider(_methodReplacementProvider, parameters.TargetMethod, parameters.GetMethodReplacementProviderMethod);

            _getMethodReplacementProvider = getMethodReplacementProvider;
            _registryType = parameters.RegistryType;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InterceptAndSurroundMethodBody"/> class.
        /// </summary>
        /// <param name="emitter">The emitter that will instantiate the <see cref="IInvocationInfo"/> instance.</param>
        /// <param name="getInterceptionDisabled">The emitter that will determine whether or not method interception is enabled.</param>
        /// <param name="surroundMethodBody">The <see cref="ISurroundMethodBody"/> instance that will add the epilogs and prologs to the method body.</param>
        /// <param name="getInstanceMethodReplacementProvider">The emitter that will obtain the method replacement provider instance.</param>
        /// <param name="getClassMethodReplacementProvider">The emitter that will obtain the class-level method replacement provider instance.</param>
        /// <param name="addMethodReplacement">The instruction emitter that will add the call to obtain the method body replacement instance. </param>
        /// <param name="parameters">The parameters that describe the context of the method body rewrite.</param>
        public InterceptAndSurroundMethodBody(IEmitInvocationInfo emitter,
                                              IInstructionEmitter getInterceptionDisabled,
                                              ISurroundMethodBody surroundMethodBody,
                                              IInstructionEmitter getInstanceMethodReplacementProvider,
                                              IInstructionEmitter getClassMethodReplacementProvider,
                                              IInstructionEmitter addMethodReplacement,
                                              IMethodBodyRewriterParameters parameters)
        {
            _getInterceptionDisabled = getInterceptionDisabled;
            _surroundMethodBody      = surroundMethodBody;
            _getInstanceMethodReplacementProvider = getInstanceMethodReplacementProvider;
            _getClassMethodReplacementProvider    = getClassMethodReplacementProvider;
            _addMethodReplacement = addMethodReplacement;
            _parameters           = parameters;
            _emitter = emitter;

            _interceptionDisabled = parameters.InterceptionDisabled;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InterceptAndSurroundMethodBody"/> class.
        /// </summary>
        /// <param name="emitter">The emitter that will instantiate the <see cref="IInvocationInfo"/> instance.</param>
        /// <param name="getInterceptionDisabled">The emitter that will determine whether or not method interception is enabled.</param>
        /// <param name="surroundMethodBody">The <see cref="ISurroundMethodBody"/> instance that will add the epilogs and prologs to the method body.</param>
        /// <param name="getInstanceMethodReplacementProvider">The emitter that will obtain the method replacement provider instance.</param>
        /// <param name="getClassMethodReplacementProvider">The emitter that will obtain the class-level method replacement provider instance.</param>
        /// <param name="addMethodReplacement">The instruction emitter that will add the call to obtain the method body replacement instance. </param>
        /// <param name="parameters">The parameters that describe the context of the method body rewrite.</param>
        public InterceptAndSurroundMethodBody(IEmitInvocationInfo emitter, 
            IInstructionEmitter getInterceptionDisabled,
            ISurroundMethodBody surroundMethodBody,
            IInstructionEmitter getInstanceMethodReplacementProvider,
            IInstructionEmitter getClassMethodReplacementProvider,
            IInstructionEmitter addMethodReplacement,
            IMethodBodyRewriterParameters parameters)
        {
            _getInterceptionDisabled = getInterceptionDisabled;
            _surroundMethodBody = surroundMethodBody;
            _getInstanceMethodReplacementProvider = getInstanceMethodReplacementProvider;
            _getClassMethodReplacementProvider = getClassMethodReplacementProvider;
            _addMethodReplacement = addMethodReplacement;
            _parameters = parameters;
            _emitter = emitter;

            _interceptionDisabled = parameters.InterceptionDisabled;
        }
Beispiel #9
0
 public GetInterceptionDisabled(IMethodBodyRewriterParameters parameters)
 {
     _hostMethod           = parameters.TargetMethod;
     _interceptionDisabled = parameters.InterceptionDisabled;
 }
 public GetInterceptionDisabled(IMethodBodyRewriterParameters parameters)
 {
     _hostMethod = parameters.TargetMethod;
     _interceptionDisabled = parameters.InterceptionDisabled;
 }