/// <summary>
        ///     Modifies the <paramref name="target" /> to support intercepting calls to the 'new' operator.
        /// </summary>
        /// <param name="target">The item to be modified.</param>
        /// <param name="newInstanceFilter">The filter that will determine which constructor calls should be intercepted.</param>
        /// <param name="methodFilter">
        ///     The filter that will determine which host methods should be modified to support new instance
        ///     interception.
        /// </param>
        public static void InterceptNewInstances(this AssemblyDefinition target,
                                                 INewInstanceFilter newInstanceFilter, IMethodFilter methodFilter)
        {
            var redirector = new RedirectNewInstancesToActivator(newInstanceFilter);

            target.InterceptNewInstancesWith(redirector, methodFilter.ShouldWeave);
        }
        /// <summary>
        /// Modifies the <paramref name="target"/> to support intercepting calls to the 'new' operator.
        /// </summary>
        /// <param name="target">The item to be modified.</param>
        /// <param name="newInstanceFilter">The filter that will determine which constructor calls should be intercepted.</param>
        /// <param name="methodFilter">The filter that will determine which host methods should be modified to support new instance interception.</param>
        public static void InterceptNewInstances(this IReflectionVisitable target, INewInstanceFilter newInstanceFilter,
                                                 IMethodFilter methodFilter)
        {
            var redirector = new RedirectNewInstancesToActivator(newInstanceFilter);

            target.InterceptNewInstancesWith(redirector, methodFilter.ShouldWeave);
        }
 public RedirectNewInstancesToActivator(Func<MethodReference, TypeReference, MethodReference, bool> filter)
 {
     _filter = new NewInstanceInterceptionAdapter(filter);
 }
 public RedirectNewInstancesToActivator(INewInstanceFilter filter)
 {
     _filter = filter;
 }
 /// <summary>
 /// Modifies the <paramref name="target"/> to support intercepting calls to the 'new' operator.
 /// </summary>
 /// <param name="target">The item to be modified.</param>
 /// <param name="newInstanceFilter">The filter that will determine which constructor calls should be intercepted.</param>
 /// <param name="methodFilter">The filter that will determine which host methods should be modified to support new instance interception.</param>
 public static void InterceptNewInstances(this IReflectionVisitable target, INewInstanceFilter newInstanceFilter,
                                          IMethodFilter methodFilter)
 {
     var redirector = new RedirectNewInstancesToActivator(newInstanceFilter);
     target.InterceptNewInstancesWith(redirector, methodFilter.ShouldWeave);
 }
 public RedirectNewInstancesToActivator(Func <MethodReference, TypeReference, MethodReference, bool> filter)
 {
     _filter = new NewInstanceInterceptionAdapter(filter);
 }
 public RedirectNewInstancesToActivator(INewInstanceFilter filter)
 {
     _filter = filter;
 }