public override async Task <bool> InvokeAsync(string paramList) { var filename = QueryParam <string>("Filename", GetParam(paramList, 0)); if (!System.IO.File.Exists(filename)) { OutputError("File {0} does not exist", filename); return(false); } var fileLines = System.IO.File.ReadAllLines(filename); OutputInformation("There are {0} commands in file {1}.", fileLines.Length, filename); var index = 0; foreach (var line in fileLines) { OutputInformation("Command {0}: {1}", ++index, line); if (!line.StartsWith("#")) { var success = _rootCommand.ExecuteCommand(line); if (!success) { OutputError("Terminating command chain."); return(false); } } } return(true); }
private bool ExecuteCommand(string entry) { var success = _rootCommand.ExecuteCommand(entry); if (_commandMode && !success) { _rootCommand.OutputError("Terminating command chain."); return(false); } return(true); }