public static bool CheckIfResponseRequired(TcpMessaging.Command cmd) { try { var methodInfo = typeof(Plugin).GetNestedType(cmd.ToString()).GetMethod("Invoke"); if (methodInfo == null) { throw new NullReferenceException("Method not found!"); } return(methodInfo.ReturnType != typeof(void)); } catch (Exception e) { Console.WriteLine(e); throw; } }
public static bool CheckIfValidParameters(TcpMessaging.Command cmd, params object[] args) { var methodInfo = typeof(Plugin).GetNestedType(cmd.ToString()).GetMethod("Invoke"); if (methodInfo == null) { throw new NullReferenceException("Method not found!"); } var parameterInfos = methodInfo.GetParameters(); var i = 0; foreach (var parameter in parameterInfos) { if (parameter.ParameterType != args[i].GetType()) { return(false); } i++; } return(true); }