示例#1
0
        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);
        }
示例#2
0
 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}");
     }
 }
示例#3
0
 protected abstract bool ParseLine(string line, out ConsoleResult result,
                                   out ConsoleCommand command, out string parsedCmd);
示例#4
0
 protected abstract void IntVariableCommand(ConsoleResult result, object data);