Пример #1
0
        private void ReadPacket(Q3HuffmanStream stream)
        {
            List <string> cmdLog  = new List <string> ();
            PacketKind    pktKind = stream.BeginRead();

            this.reliableAcknowledge = stream.ReadInt32();
            ServerCommandType cmd;

            while (ServerCommandType.EOF != (cmd = ( ServerCommandType )stream.ReadByte()))
            {
                switch (cmd)
                {
                case ServerCommandType.Nop:
                    cmdLog.Add("Nop");
                    break;

                case ServerCommandType.ServerCommand:
                    this.ParseCommandString(stream);
                    cmdLog.Add("ServerCommand");
                    break;

                case ServerCommandType.GameState:
                    this.ParseGamestate(stream);
                    cmdLog.Add("GameState");
                    break;

                case ServerCommandType.Snapshot:
                    this.ParseSnapshot(stream);
                    cmdLog.Add("Snapshot");
                    break;

                case ServerCommandType.Download:
                    // We never download ;)
                    return;

                default:
                    // Unknown command
                    return;
                }
            }

            stream.EndRead();
        }