示例#1
0
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     Protocol    = buf.ReadInt16();
     ServerCount = buf.ReadInt32();
     IsHltv      = buf.ReadBoolean();
     IsDedicated = buf.ReadBoolean();
     ClientCrc   = buf.ReadInt32();
     MaxClasses  = buf.ReadUInt16();
     MapCrc      = buf.ReadInt32();
     PlayerSlot  = buf.ReadByte();
     MaxClients  = buf.ReadByte();
     if (demo.Protocol == 4)
     {
         Unk = buf.ReadInt32();
     }
     else if (demo.NetworkProtocol == 24)
     {
         Unk = buf.ReadBits(96);
     }
     TickInterval    = buf.ReadSingle();
     OperatingSystem = buf.ReadChar();
     GameDir         = buf.ReadString();
     MapName         = buf.ReadString();
     SkyName         = buf.ReadString();
     HostName        = buf.ReadString();
     return(Task.CompletedTask);
 }
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     Position          = buf.ReadVectorBitCoord();
     DecalTextureIndex = buf.ReadUBits(9);
     if (buf.ReadBoolean())
     {
         EntityIndex = buf.ReadUBits(11);
         ModelIndex  = buf.ReadUBits(11);
     }
     LowPriority = buf.ReadBoolean();
     return(Task.CompletedTask);
 }
示例#3
0
        public override Task Read(SourceBufferReader buf, SourceDemo demo)
        {
            MaxEntries     = buf.ReadBits(11);
            IsDelta        = buf.ReadBoolean();
            DeltaFrom      = (IsDelta) ? buf.ReadInt32() : 0;
            BaseLine       = buf.ReadBoolean();
            UpdatedEntries = buf.ReadBits(11);
            var length = buf.ReadBits(20);

            UpdateBaseline = buf.ReadBoolean();
            buf.SeekBits(length);
            return(Task.CompletedTask);
        }
示例#4
0
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     TransferId    = buf.ReadUInt32();
     FileName      = buf.ReadString();
     FileRequested = buf.ReadBoolean();
     return(Task.CompletedTask);
 }
示例#5
0
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     NeedsDecoder = buf.ReadBoolean();
     Length       = buf.ReadInt16();
     buf.SeekBits(Length);
     //Data = buf.ReadBytes(Length);
     return(Task.CompletedTask);
 }
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     TableId = buf.ReadBits(5);
     if (buf.ReadBoolean())
     {
         NumChangedEntries = buf.ReadInt16();
     }
     buf.SeekBits(buf.ReadBits(20));
     return(Task.CompletedTask);
 }
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     Relative = buf.ReadBoolean();
     Angle    = new QAngle
                (
         buf.ReadInt16(),
         buf.ReadInt16(),
         buf.ReadInt16()
                );
     return(Task.CompletedTask);
 }
示例#8
0
        public override Task Read(SourceBufferReader buf, SourceDemo demo)
        {
            ReliableSound = buf.ReadBoolean();
            Sounds        = (ReliableSound)
                ? 1
                : buf.ReadUBits(8);
            var length = (ReliableSound)
                ? buf.ReadUBits(8)
                : buf.ReadUBits(16);

            buf.SeekBits((int)length);
            return(Task.CompletedTask);
        }
示例#9
0
        public override Task Read(SourceBufferReader buf, SourceDemo demo)
        {
            TableName  = buf.ReadString();
            MaxEntries = buf.ReadUInt16();
            var bits = (int)System.Math.Log(MaxEntries, 2) + 1;

            Entries = bits != 1 ? buf.ReadUBits(bits) : buf.ReadUBits(1);
            var length = buf.ReadBits(20);

            UserDataFixedSize = buf.ReadBoolean();
            UserDataSize      = (UserDataFixedSize) ? buf.ReadBits(12) : 0;
            UserDataSizeBits  = (UserDataFixedSize) ? buf.ReadBits(4) : 0;
            Flags             = buf.ReadBits(demo.Protocol == 4 ? 2 : 1);
            buf.SeekBits(length);
            return(Task.CompletedTask);
        }
示例#10
0
        public override Task Read(SourceBufferReader buf, SourceDemo demo)
        {
            var length = buf.ReadInt16();

            CreateOnClient = buf.ReadBoolean();
            if (!CreateOnClient)
            {
                while (length-- > 0)
                {
                    ServerClasses.Add(new ServerClassInfo()
                    {
                        ClassId       = (short)buf.ReadBits((int)System.Math.Log(length, 2) + 1),
                        ClassName     = buf.ReadString(),
                        DataTableName = buf.ReadString()
                    });
                }
            }
            return(Task.CompletedTask);
        }
示例#11
0
        public static Task Read(this SourceDemo demo, StringTables frame)
        {
            var buf    = frame.Buffer;
            int tables = buf.ReadByte();

            for (int i = 0; i < tables; i++)
            {
                var name  = buf.ReadString();
                var table = new StringTable(name);

                var entries = buf.ReadInt16();
                for (int j = 0; j < entries; j++)
                {
                    var entry   = buf.ReadString();
                    var data    = default(byte[]);
                    var version = default(long);
                    var xuid    = default(long);
                    var info    = default(TableInfoBase);

                    if (buf.ReadBoolean())
                    {
                        var length = buf.ReadInt16();
                        data = buf.ReadBytes(length);

                        // TODO
                        if (name == Const.INSTANCE_BASELINE_TABLENAME)
                        {
                            info = new InstanceBaseline()
                            {
                                Id = int.Parse(entry)
                            };
                        }
                        else if (name == Const.LIGHT_STYLES_TABLENAME)
                        {
                        }
                        else if (name == Const.SERVER_STARTUP_DATA_TABLENAME)
                        {
                        }
                        else if (name == Const.USER_INFO_TABLENAME)
                        {
                            var buf2 = new SourceBufferReader(data);
                            if (demo.GameDirectory == "csgo")
                            {
                                // 8 bytes
                                version = BitConverter.ToInt64(buf2.ReadBytes(8), 0);
                                // 8 bytes
                                xuid = BitConverter.ToInt64(buf2.ReadBytes(8), 0);
                            }
                            else
                            {
                                // 4 bytes
                                version = buf2.ReadInt32();
                                // 4 bytes
                                xuid = buf2.ReadInt32();
                            }

                            info = new PlayerInfo()
                            {
                                // 32 bytes
                                Name = Encoding.ASCII.GetString(buf2.ReadBytes(Const.MAX_PLAYER_NAME_LENGTH)).TrimEnd('\0'),
                                // 4 bytes
                                UserId = buf2.ReadInt32(),
                                // 33 bytes
                                Guid = Encoding.ASCII.GetString(buf2.ReadBytes(Const.SIGNED_GUID_LEN + 1)).TrimEnd('\0'),
                                // 4 bytes
                                FriendsId = buf2.ReadInt32(),
                                // 32 bytes
                                FriendsName = Encoding.ASCII.GetString(buf2.ReadBytes(Const.MAX_PLAYER_NAME_LENGTH)).TrimEnd('\0'),
                                // 1 byte
                                Fakeplayer = buf2.ReadBoolean(),
                                // 1 byte
                                IsHltv = buf2.ReadBoolean(),
                                // 16 bytes
                                CustomFiles = new int[4]
                                {
                                    buf2.ReadInt32(),
                                        buf2.ReadInt32(),
                                        buf2.ReadInt32(),
                                        buf2.ReadInt32()
                                },
                                // 2 bytes
                                FilesDownloaded = buf2.ReadChar()
                            };
                        }
                    }
                    table.AddEntry(new StringTableEntry()
                    {
                        Name    = entry,
                        RawData = data,
                        Version = version,
                        Xuid    = xuid,
                        Info    = info
                    });
                }

                if (buf.ReadBoolean())
                {
                    var centries = buf.ReadInt16();
                    for (var j = 0; j < centries; j++)
                    {
                        var centry = buf.ReadString();
                        var ddata  = default(byte[]);
                        if (buf.ReadBoolean())
                        {
                            var length = buf.ReadInt16();
                            ddata = buf.ReadBytes(length);
                        }
                        table.AddClientEntry(new ClientEntry()
                        {
                            Name    = centry,
                            RawData = ddata
                        });
                    }
                }
                frame.Tables.Add(table);
            }
            return(Task.CompletedTask);
        }
示例#12
0
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     Paused = buf.ReadBoolean();
     return(Task.CompletedTask);
 }