public static void InterceptMethodBody(this IReflectionStructureVisitable target,
                                               Func<MethodReference, bool> methodFilter, Func<TypeReference, bool> typeFilter)
        {
            target.Accept(new ImplementModifiableType(typeFilter));

            var interceptMethodBody = new InterceptMethodBody(methodFilter);
            target.WeaveWith(interceptMethodBody, methodFilter);
        }
Esempio n. 2
0
        public static void InterceptMethodBody(this IReflectionStructureVisitable target,
                                               Func <MethodReference, bool> methodFilter, Func <TypeReference, bool> typeFilter)
        {
            target.Accept(new ImplementModifiableType(typeFilter));

            var interceptMethodBody = new InterceptMethodBody(methodFilter);

            target.WeaveWith(interceptMethodBody, methodFilter);
        }
        /// <summary>
        ///     Intercepts all method bodies on the target item.
        /// </summary>
        /// <param name="target">The target to be modified.</param>
        /// <param name="methodFilter">The method filter that will determine the methods that will be modified.</param>
        public static void InterceptMethodBody(this TypeDefinition target,
                                               Func <MethodReference, bool> methodFilter)
        {
            var typeFilter = GetTypeFilter();

            target.Accept(new ImplementModifiableType(typeFilter));

            IMethodWeaver interceptMethodBody = new InterceptMethodBody(methodFilter);

            target.WeaveWith(interceptMethodBody);
        }