public static void Register(string eventName, Delegate eventDelegate) { if (eventDelegate == null) { throw new ArgumentNullException(nameof(eventDelegate)); } foreach (var handler in eventDelegate.GetInvocationList()) { var method = handler.Method; var dType = handler.Method.DeclaringType; if (dType == null) { Logger.LogWarning("DeclaringType null for: " + method.Name); continue; } MeasurableMethod o = new MeasurableMethod { MeasureType = eventName, Measurements = new List <decimal>(), Method = method }; HarmonyProfiling.RegisterMethod(o); } }
public static void Register(string measurableType, MethodBase targetMethod) { if (targetMethod == null) { throw new ArgumentNullException(nameof(targetMethod)); } MeasurableMethod o = new MeasurableMethod { MeasureType = measurableType, Measurements = new List <decimal>(), Method = targetMethod }; HarmonyProfiling.RegisterMethod(o); }