public static void RedirectCalls(List <RedirectCallsState> callStates, Type from, Type to, string methodName, int parametersLength) { MethodInfo originalMethod = from.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(m => m.Name == methodName && m.GetParameters().Length == parametersLength); MethodInfo replacementMethod = to.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(m => m.Name == methodName && m.GetParameters().Length == parametersLength); if (originalMethod != null && replacementMethod != null) { callStates.Add(RedirectionHelper.RedirectCalls(originalMethod, replacementMethod)); } else { DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, String.Format("RedirectCalls失敗:" + methodName)); } }
public static void RedirectCalls(List <RedirectCallsState> callStates) { RedirectionHelper.RedirectCalls(callStates, typeof(UIDateTimeWrapper), typeof(CustomUIDateTimeWrapper), "Check", 1); }