Example #1
0
        private string ExtractCommandKey(CommandParsingContext context, string command)
        {
            var prefixes   = context.GetPrefixes();
            var separators = context.GetSeparators();

            // Trim off any prefix characters from the start of the command and split on the first occurrence of any separator characters
            string commandKey = command.TrimStart(prefixes);
            int    splitIndex = commandKey.IndexOfAny(separators);

            if (splitIndex > -1 && splitIndex < commandKey.Length)
            {
                commandKey = commandKey.Substring(0, splitIndex);
            }

            return(commandKey);
        }
Example #2
0
        private string ExtractCommandKey(CommandParsingContext context, string command)
        {
            var prefixes = context.GetPrefixes();
            var separators = context.GetSeparators();

            // Trim off any prefix characters from the start of the command and split on the first occurrence of any separator characters
            string commandKey = command.TrimStart(prefixes);
            int splitIndex = commandKey.IndexOfAny(separators);

            if (splitIndex > -1 && splitIndex < commandKey.Length)
            {
                commandKey = commandKey.Substring(0, splitIndex);
            }

            return commandKey;
        }
Example #3
0
        private bool IsCommand(CommandParsingContext context, string argument)
        {
            var prefixes = context.GetPrefixes();

            return(argument.StartsWithAny(prefixes));
        }
Example #4
0
 private bool IsCommand(CommandParsingContext context, string argument)
 {
     var prefixes = context.GetPrefixes();
     return argument.StartsWithAny(prefixes);
 }