当前位置: 首页>>代码示例>>C#>>正文


C# IInvocationInfo类代码示例

本文整理汇总了C#中IInvocationInfo的典型用法代码示例。如果您正苦于以下问题:C# IInvocationInfo类的具体用法?C# IInvocationInfo怎么用?C# IInvocationInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IInvocationInfo类属于命名空间,在下文中一共展示了IInvocationInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AfterInvoke

 public void AfterInvoke(IInvocationInfo context, object returnValue)
 {
     foreach (IAroundInvoke invoke in _aroundInvokeList)
     {
         invoke.AfterInvoke(context, returnValue);
     }
 }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:7,代码来源:CompositeAroundInvoke.cs

示例2: Intercept

        public override object Intercept(IInvocationInfo info)
        {
            //typeof(LobbyMenu).GetField ("_hoverButtonInside", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance).SetValue (info.Target, false);
            try {
                Type lobbyMenu = typeof(LobbyMenu);

                if (first) {

                    GUISkin gUISkin7 = ScriptableObject.CreateInstance<GUISkin> ();

                    text = new Texture2D(87, 39); //115, 39
                    text.LoadImage(System.Reflection.Assembly.GetExecutingAssembly ().GetManifestResourceStream ("ScrollsModLoader.Mods.png").ReadToEnd ());

                    gUISkin7.button.normal.background = text;
                    gUISkin7.button.hover.background = text;
                    gUISkin7.button.active.background = text;

                    //info.Target.GUISkins.Add (gUISkin5);
                    FieldInfo GUISkins = lobbyMenu.GetField("GUISkins", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);
                    if (GUISkins == null)
                        Console.WriteLine ("GuiSkins == null");
                    ((List<GUISkin>)(GUISkins.GetValue(info.Target))).Add(gUISkin7);
                    first = false;
                }

                MethodInfo drawHeader = lobbyMenu.GetMethod ("drawHeaderButton", BindingFlags.NonPublic | BindingFlags.Instance);
                drawHeader.Invoke(info.Target, new object[] {6, "_Settings"});

            } catch (Exception exp) {
                Console.WriteLine (exp);
            }
            return info.TargetMethod.Invoke(info.Target, info.Arguments);
        }
开发者ID:kevinskyba,项目名称:ScrollsModLoader,代码行数:33,代码来源:PatchHeaderMenu.cs

示例3: ShouldReplace

        /// <summary>
        /// Determines whether or not a particular method body should be replaced at runtime.
        /// </summary>
        /// <param name="host">The host instance that contains the target method.</param>
        /// <param name="context">The context surrounding the method call.</param>
        /// <returns>Returns <c>true</c> if the method body should be swapped; otherwise, it will return <c>false</c>.</returns>
        protected override bool ShouldReplace(object host, IInvocationInfo context)
        {
            if (MethodReplacementPredicate == null)
                return true;

            return MethodReplacementPredicate(context);
        }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:13,代码来源:SimpleMethodReplacementProvider.cs

示例4: Intercept

        /// <summary>
        /// A method that redirects the method calls to 
        /// the functor instance.
        /// </summary>
        /// <param name="info">The <see cref="IInvocationInfo"/> instance that describes the context of the method call.</param>
        /// <returns>The return value from the target method.</returns>
        public object Intercept(IInvocationInfo info)
        {
            if (_doIntercept == null)
                throw new NotImplementedException();

            return _doIntercept(info);
        }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:13,代码来源:FunctorAsInterceptor.cs

示例5: GetProvider

        /// <summary>
        /// Returns the provider that is currently attached to the registry.
        /// </summary>
        /// <param name="host">The type that is currently being intercepted.</param>
        /// <param name="info">The <see cref="IInvocationInfo"/> object that describes the invocation context.</param>
        /// <returns>A <see cref="IMethodReplacementProvider"/> that will determine the code that will be executed once a target method is called.</returns>
        public static IMethodReplacementProvider GetProvider(object host, IInvocationInfo info)
        {
            if (_provider == null)
                return null;

            return _provider.CanReplace(host, info) ? _provider : null;
        }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:13,代码来源:MethodBodyReplacementProviderRegistry.cs

示例6: InvocationInfoInterceptor

 /// <summary>
 /// Initializes the class with a functor that can provide the actual target instance.
 /// </summary>
 /// <param name="getActualTarget">The <see cref="Func{TResult}"/> that will provide the target instance that will be used for the method invocation.</param>
 /// <param name="methodInvoke">The method invoker.</param>
 /// <param name="realInfo">The <see cref="IInvocationInfo"/> instance that describes the current execution context.</param>
 internal InvocationInfoInterceptor(IInvocationInfo realInfo, Func<object> getActualTarget,
                                    IMethodInvoke<MethodInfo> methodInvoke)
     : base(methodInvoke)
 {
     _getActualTarget = getActualTarget;
     _realInfo = realInfo;
 }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:13,代码来源:InvocationInfoInterceptor.cs

示例7: GetSurroundingImplementation

        public IAroundInvoke GetSurroundingImplementation(IInvocationInfo context)
        {
            if (Predicate == null)
                return _around;

            return Predicate(context) ? _around : null;
        }
开发者ID:thlorenz,项目名称:WPFLinFu,代码行数:7,代码来源:SimpleAroundInvokeProvider.cs

示例8: Intercept

        public object Intercept(IInvocationInfo info)
        {
            var args = string.Join(", ", info.Arguments.Select(x => (x ?? string.Empty).ToString()));
            Debug.WriteLine(string.Format("Linfu: {0}({1})", info.TargetMethod.Name, args));

            return info.TargetMethod.Invoke(info.Target, info.Arguments);
        }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:7,代码来源:LinfuInterceptionLogger.cs

示例9: Invoke

 public object Invoke(IInvocationInfo invocationInfo)
 {
     if (session.InTransaction)
     {
         return invocationInfo.Proceed();
     }
     using (var transaction = session.Connection.BeginTransaction())
     {
         session.InTransaction = true;
         try
         {
             var result = invocationInfo.Proceed();
             transaction.Commit();
             return result;
         }
         catch (Exception)
         {
             transaction.Rollback();
             throw;
         }
         finally
         {
             session.InTransaction = false;
         }
     }
 }
开发者ID:sunloving,项目名称:rooms-and-furniture,代码行数:26,代码来源:TransactionInterceptor.cs

示例10: BeforeInvoke

 public void BeforeInvoke(IInvocationInfo context)
 {
     foreach (IAroundInvoke invoke in _aroundInvokeList)
     {
         invoke.BeforeInvoke(context);
     }
 }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:7,代码来源:CompositeAroundInvoke.cs

示例11: Intercept

        /// <summary>
        /// Intercepts a method call using the given
        /// <see cref="IInvocationInfo"/> instance.
        /// </summary>
        /// <param name="info">The <see cref="IInvocationInfo"/> instance that will 
        /// contain all the necessary information associated with a 
        /// particular method call.</param>
        /// <returns>The return value of the target method. If the return type of the target
        /// method is <see cref="void"/>, then the return value will be ignored.</returns>
        public virtual object Intercept(IInvocationInfo info)
        {
            object target = GetTarget(info);
            MethodBase method = info.TargetMethod;
            object[] arguments = info.Arguments;

            return _methodInvoke.Invoke(target, (MethodInfo) method, arguments);
        }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:17,代码来源:BaseInterceptor.cs

示例12: Intercept

        /// <summary>
        /// Intercepts a method call using the given
        /// <see cref="IInvocationInfo"/> instance.
        /// </summary>
        /// <param name="info">The <see cref="IInvocationInfo"/> instance that will 
        /// contain all the necessary information associated with a 
        /// particular method call.</param>
        /// <returns>The return value of the target method. If the return type of the target
        /// method is <see cref="Void"/>, then the return value will be ignored.</returns>
        public virtual object Intercept(IInvocationInfo info)
        {
            var target = GetTarget(info);
            var method = info.TargetMethod;
            var arguments = info.Arguments;

            return _methodInvoke.Invoke(target, (MethodInfo)method, arguments);
        }
开发者ID:sdether,项目名称:LinFu,代码行数:17,代码来源:BaseInterceptor.cs

示例13: Intercept

        public object Intercept(IInvocationInfo info)
        {
            var methodName = info.TargetMethod.Name;

            Console.WriteLine("method '{0}' called", methodName);

            return info.TargetMethod;
        }
开发者ID:thlorenz,项目名称:WPFLinFu,代码行数:8,代码来源:MethodInterceptor.cs

示例14: GetPendingCalls

        public int GetPendingCalls(IInvocationInfo context)
        {
            int threadId = Thread.CurrentThread.ManagedThreadId;
            if (!_counts.ContainsKey(threadId))
                return 0;

            return _counts[threadId].GetPendingCalls(context);
        }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:8,代码来源:CallCounter.cs

示例15: CanReplace

        /// <summary>
        /// Determines whether or not the current method implementation can be replaced.
        /// </summary>
        /// <param name="host">The target instance of the method call.</param>
        /// <param name="context">The <see cref="IInvocationInfo"/> that describes the context of the method call.</param>
        /// <returns><c>true</c> if the method can be intercepted; otherwise, it will return <c>false</c>.</returns>
        public bool CanReplace(object host, IInvocationInfo context)
        {
            var pendingCalls = _counter.GetPendingCalls(context);

            if (pendingCalls > 0)
                return false;

            return ShouldReplace(host, context);
        }
开发者ID:jam231,项目名称:LinFu,代码行数:15,代码来源:BaseMethodReplacementProvider.cs


注:本文中的IInvocationInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。