private void FindCmdMethod(string command, out MethodInfo minfo, out ConsoleMethod cmethod) { MethodInfo[] methods = CommandMethods; minfo = null; cmethod = null; foreach (MethodInfo method in methods) { ConsoleMethod[] attributes = method.GetCustomAttributes(typeof(ConsoleMethod), false) as ConsoleMethod[]; if (attributes != null && attributes.Length > 0) { if (attributes[0].Command == command) { minfo = method; cmethod = attributes[0]; } } } }
private string GetCommandDescr(MethodInfo minfo) { ConsoleMethod attribute = GetAttribute(minfo); return(attribute != null ? attribute.Description : string.Empty); }
private string GetCommandName(MethodInfo minfo) { ConsoleMethod attribute = GetAttribute(minfo); return(attribute != null ? attribute.Command : string.Empty); }