protected override bool ParseLine(string line, out ConsoleResult result, out ConsoleCommand command, out string parsedCmd) { if (string.IsNullOrWhiteSpace(line)) { result = null; command = null; parsedCmd = null; return(false); } line = line.TrimStart(); var space = line.IndexOf(' '); parsedCmd = space > 0 ? line.Substring(0, space) : line; if (!Commands.TryGetValue(parsedCmd, out command)) { result = null; return(false); } var args = string.Empty; if (space > 0 && space + 1 < line.Length) { args = line.Substring(space + 1); } result = new ConsoleResult(args); return(true); }
protected override void StrVariableCommand(ConsoleResult result, object data) { if (result.NumArguments != 0) { ((ConfigString)data).Value = (string)result[0]; } else { Print(OutputLevel.STANDARD, "console", $"Value: {((ConfigString) data).Value}"); } }
protected abstract bool ParseLine(string line, out ConsoleResult result, out ConsoleCommand command, out string parsedCmd);
protected abstract void IntVariableCommand(ConsoleResult result, object data);