예제 #1
0
 public static void Prefix(ref ExecState __state, MethodBase __originalMethod)
 {
     //Mod.Log.Info?.Write($"PREFIX: {__originalMethod.Name}");
     ProfilePatches.Target target = new ProfilePatches.Target(__originalMethod.DeclaringType, __originalMethod);
     __state = new ExecState(target);
     __state.Start();
     ModState.StackDepth++;
 }
예제 #2
0
        public static void Postfix(ref ExecState __state, Object __instance)
        {
            //Mod.Log.Info?.Write($"POSTFIX: {__state.name}");
            if (ModState.StackDepth > 0)
            {
                ModState.StackDepth--;
            }
            if (__state != null)
            {
                __state.Stop(__instance);

                // Increment our counter
                if (!ModState.InvokeCounts.ContainsKey(__state.target.ToString()))
                {
                    ModState.InvokeCounts[__state.target.ToString()] = new List <long>();
                }
                ModState.InvokeCounts[__state.target.ToString()].Add(__state.stopWatch.ElapsedTicks);
            }
        }