Command[] LoadCommandsInType(Type type) { List <Command> commands = new List <Command>(); MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < methods.Length; i++) { CommandAttributeVerifier verifier = new CommandAttributeVerifier(methods[i]); if (verifier.hasCommandAttribute) { if (!verifier.isDeclarationSupported) { CommandsManager.SendException(new UnsupportedCommandDeclarationException(methods[i])); continue; } Command command = verifier.ExtractCommand(); commands.Add(command); } } return(commands.ToArray()); }
Command[] GetCommandsInType(Type type) { List <Command> commands = new List <Command>(); MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < methods.Length; i++) { CommandAttributeVerifier verifier = new CommandAttributeVerifier(methods[i]); if (!verifier.hasCommandAttribute) { continue; } if (!verifier.isDeclarationSupported) { notificationsHandler.NotifyException(new UnsupportedCommandDeclaration(methods[i])); } else { commands.Add(verifier.ExtractCommand()); } } return(commands.ToArray()); }