Exemplo n.º 1
0
        void R_ClientInfo(NetConnection client, NetBuffer data, ushort numArgs)
        {
            try
            {
                if (numArgs == 1)
                {
                    DisconnectClientForGameVersion(client);
                }

                string      playerName    = data.ReadString();
                GameVersion clientVersion = GameVersion.Deserialize(data);

                if (!GameVersion.Current.Equals(clientVersion))
                {
                    DisconnectClientForGameVersion(client);
                }

                ClientInfo ci = new ClientInfo(playerName);

                NetworkPlayer netPlayer;
                if (netPlayers.TryGetValue(client, out netPlayer))
                {
                    // Process information from client info
                    ProcessClientInfo(netPlayer, client, ci);
                }
                else
                {
                    // Just incase the client got here first, just stash it for later
                    stashedClientInfo.Add(client, ci);
                }
            }
            catch (Exception)
            {
                DashCMD.WriteError("[NPM] Client {0} send invalid client info!", client);
                client.Disconnect("Invalid client info.");
            }
        }