Beispiel #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);
 }
Beispiel #2
0
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     Tick                      = buf.ReadInt32();
     HostFrameTime             = buf.ReadInt16();
     HostFrameTimeStdDeviation = buf.ReadInt16();
     return(Task.CompletedTask);
 }
Beispiel #3
0
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     SignonState = buf.ReadByte();
     SpawnCount  = buf.ReadInt32();
     if (demo.Protocol == 4)
     {
         NumServerPlayers = buf.ReadInt32();
         var length = buf.ReadInt32();
         if (length > 0)
         {
             PlayerNetworkIds = buf.ReadBytes(length);
         }
         length = buf.ReadInt32();
         if (length > 0)
         {
             MapName = buf.ReadString(length);
         }
     }
     return(Task.CompletedTask);
 }
Beispiel #4
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);
        }
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     buf.SeekBytes(buf.ReadInt32());
     return(Task.CompletedTask);
 }
Beispiel #6
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);
        }
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     Cookie   = buf.ReadInt32();
     CvarName = buf.ReadString();
     return(Task.CompletedTask);
 }
Beispiel #8
0
 public override Task Read(SourceBufferReader buf, SourceDemo demo)
 {
     MenuType = buf.ReadInt16();
     Data     = buf.ReadBytes(buf.ReadInt32());
     return(Task.CompletedTask);
 }