Yaircc.Net.IRC.KickMessage.TryParse C# (CSharp) Method

TryParse() public method

Attempts to parse the input specified by the user into the Message.
public TryParse ( string input ) : ParseResult
input string The input from the user.
return ParseResult
        public override ParseResult TryParse(string input)
        {
            ParseResult retval;
            string pattern = @"/kick\s(?<nickname>[^\s]+)+?(\s(?<reason>.+))?";
            Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
            Match match = regex.Match(input);

            if (match.Success)
            {
                this.Parameters = new string[] { this.ChannelName, match.Groups["nickname"].Value };

                if (match.Groups["reason"].Success)
                {
                    this.TrailingParameter = match.Groups["reason"].Value;
                }

                retval = new ParseResult(true, string.Empty);
            }
            else
            {
                retval = new ParseResult(false, Strings_MessageParseResults.MissingParameter_Nickname);
            }

            return retval;
        }