private object[] GetArguments(ConsoleCommand executableCommand) { var parameters = new object[executableCommand.ArgumentCount]; if (arguments.Count < executableCommand.ArgumentCount) { throw new InvalidOperationException("Not enough number of arguments."); } for (byte i = 0; i < executableCommand.ArgumentCount; i++) { if (!ParsingUtility.TryParse(arguments[i], executableCommand.GetArgumentType(i), out var parsedParameter)) { throw new InvalidCastException($"Could not correctly parse the argument {arguments[i]} as {executableCommand.GetArgumentType(i)}."); } parameters[i] = parsedParameter; } return(parameters); }
private void ParseInput() { arguments.Clear(); ParsingUtility.ParseCommandline(commandLine, out command, arguments); }