Exemplo n.º 1
0
        private void DoWhoReplyReceived(string hostName, string userName, string extraInfo)
        {
            WhoReplyReceived?.Invoke(this, new WhoEventArgs(userName, extraInfo));

            string[] eInfoParts = extraInfo.Split(' ');

            if (eInfoParts.Length < 3)
            {
                return;
            }

            string gameName = eInfoParts[2];

            int gameIndex = gameCollection.GetGameIndexFromInternalName(gameName);

            if (gameIndex == -1)
            {
                return;
            }

            var user = UserList.Find(u => u.Name == userName);

            if (user != null)
            {
                user.GameID   = gameIndex;
                user.Hostname = hostName;

                channels.ForEach(ch => ch.UpdateGameIndexForUser(userName));

                UserGameIndexUpdated?.Invoke(this, new UserEventArgs(user));
            }
        }