예제 #1
0
        private IgsUser CreateUserFromTelnetLine(string line)
        {
            var match = this._regexUser.Match(line);

            if (!match.Success)
            {
                throw new Exception("IGS SERVER returned invalid user string.");
            }

            /*
             *  1 - Name
             *  2 - Country
             *  3 - Rank
             *  4 - Calculated or self-described rank?
             *  5 - Flags
             *
             */

            var user = new IgsUser
            {
                Name    = match.Groups[1].Value,
                Country = match.Groups[2].Value,
                Rank    =
                    match.Groups[3].Value.StartsWith(" ") ? match.Groups[3].Value.Substring(1) : match.Groups[3].Value,
                LookingForAGame = match.Groups[5].Value.Contains("!"),
                RejectsRequests = match.Groups[5].Value.Contains("X")
            };

            return(user);
        }
예제 #2
0
 internal void OnPersonalInformationUpdate(IgsUser e)
 {
     PersonalInformationUpdate?.Invoke(this, e);
 }