Represents the binary Steam3 manifest format.
示例#1
0
        void Deserialize(byte[] data)
        {
            using (DataStream ds = new DataStream(data))
            {
                while (ds.SizeRemaining() > 0)
                {
                    uint magic = ds.ReadUInt32();
                    ds.Seek(-4, SeekOrigin.Current);

                    switch (magic)
                    {
                    case Steam3Manifest.MAGIC:
                        Steam3Manifest binaryManifest = new Steam3Manifest(ds);
                        ParseBinaryManifest(binaryManifest);
                        break;

                    // todo: handle protobuf manifest?

                    default:
                        throw new NotImplementedException(string.Format("Unrecognized magic value {0:X} in depot manifest.", magic));
                    }

                    uint marker = ds.ReadUInt32();
                    if (marker != magic)
                    {
                        throw new InvalidDataException("Unable to find end of message marker for depot manifest");
                    }
                }
            }
        }
示例#2
0
        void Deserialize(byte[] data)
        {
            using (var ms = new MemoryStream(data))
                using (var br = new BinaryReader(ms))
                {
                    while ((ms.Length - ms.Position) > 0)
                    {
                        uint magic = br.ReadUInt32();
                        ms.Seek(-4, SeekOrigin.Current);

                        switch (magic)
                        {
                        case Steam3Manifest.MAGIC:
                            Steam3Manifest binaryManifest = new Steam3Manifest(br);
                            ParseBinaryManifest(binaryManifest);
                            break;

                        // todo: handle protobuf manifest?

                        default:
                            throw new NotImplementedException(string.Format("Unrecognized magic value {0:X} in depot manifest.", magic));
                        }

                        uint marker = br.ReadUInt32();
                        if (marker != magic)
                        {
                            throw new InvalidDataException("Unable to find end of message marker for depot manifest");
                        }
                    }
                }
        }
示例#3
0
        void ParseBinaryManifest(Steam3Manifest manifest)
        {
            Files = new List <FileData>();
            FilenamesEncrypted = manifest.AreFileNamesEncrypted;

            foreach (var file_mapping in manifest.Mapping)
            {
                FileData filedata = new FileData(file_mapping.FileName, file_mapping.Flags, file_mapping.TotalSize, file_mapping.HashContent, FilenamesEncrypted);

                foreach (var chunk in file_mapping.Chunks)
                {
                    filedata.Chunks.Add(new ChunkData(chunk.ChunkGID, chunk.Checksum, chunk.Offset, chunk.CompressedSize, chunk.DecompressedSize));
                }

                Files.Add(filedata);
            }
        }
示例#4
0
        void ParseBinaryManifest(Steam3Manifest manifest)
        {
            Files = new List <FileData>(manifest.Mapping.Count);
            FilenamesEncrypted    = manifest.AreFileNamesEncrypted;
            DepotID               = manifest.DepotID;
            ManifestGID           = manifest.ManifestGID;
            CreationTime          = manifest.CreationTime;
            TotalUncompressedSize = manifest.TotalUncompressedSize;
            TotalCompressedSize   = manifest.TotalCompressedSize;

            foreach (var file_mapping in manifest.Mapping)
            {
                FileData filedata = new FileData(file_mapping.FileName !, file_mapping.Flags, file_mapping.TotalSize, file_mapping.HashContent !, FilenamesEncrypted, file_mapping.Chunks !.Length);

                foreach (var chunk in file_mapping.Chunks)
                {
                    filedata.Chunks.Add(new ChunkData(chunk.ChunkGID !, chunk.Checksum !, chunk.Offset, chunk.CompressedSize, chunk.DecompressedSize));
                }

                Files.Add(filedata);
            }
        }
        void ParseBinaryManifest(Steam3Manifest manifest)
        {
            Files = new List<FileData>();
            FilenamesEncrypted = manifest.AreFileNamesEncrypted;

            foreach (var file_mapping in manifest.Mapping)
            {
                FileData filedata = new FileData(file_mapping.FileName, file_mapping.Flags, file_mapping.TotalSize, file_mapping.HashContent, FilenamesEncrypted);

                foreach (var chunk in file_mapping.Chunks)
                {
                    filedata.Chunks.Add( new ChunkData( chunk.ChunkGID, chunk.CRC, chunk.Offset, chunk.CompressedSize, chunk.DecompressedSize ) );
                }

                Files.Add(filedata);
            }
        }
        void Deserialize(byte[] data)
        {
            using ( DataStream ds = new DataStream( data ) )
            {
                while ( ds.SizeRemaining() > 0 )
                {
                    uint magic = ds.ReadUInt32();
                    ds.Seek( -4, SeekOrigin.Current );

                    switch ( magic )
                    {
                        case Steam3Manifest.MAGIC:
                            Steam3Manifest binaryManifest = new Steam3Manifest( ds );
                            ParseBinaryManifest( binaryManifest );
                            break;

                            // todo: handle protobuf manifest?

                        default:
                            throw new NotImplementedException( string.Format( "Unrecognized magic value {0:X} in depot manifest.", magic ) );
                    }

                    uint marker = ds.ReadUInt32();
                    if ( marker != magic )
                        throw new InvalidDataException( "Unable to find end of message marker for depot manifest" );
                }
            }
        }
示例#7
0
        void Deserialize(byte[] data)
        {
            ContentManifestPayload payload = null;
            ContentManifestMetadata metadata = null;
            ContentManifestSignature signature = null;

            using ( var ms = new MemoryStream( data ) )
            using ( var br = new BinaryReader( ms ) )
            {
                while ( ( ms.Length - ms.Position ) > 0 )
                {
                    uint magic = br.ReadUInt32();

                    switch ( magic )
                    {
                        case Steam3Manifest.MAGIC:
                            ms.Seek(-4, SeekOrigin.Current);
                            Steam3Manifest binaryManifest = new Steam3Manifest( br );
                            ParseBinaryManifest( binaryManifest );

                            uint marker = br.ReadUInt32();
                            if ( marker != magic )
                                throw new InvalidDataException( "Unable to find end of message marker for depot manifest" );
                            break;

                        case DepotManifest.PROTOBUF_PAYLOAD_MAGIC:
                            uint payload_length = br.ReadUInt32();
                            byte[] payload_bytes = br.ReadBytes( (int)payload_length );
                            using ( var ms_payload = new MemoryStream( payload_bytes ) ) 
                                payload = Serializer.Deserialize<ContentManifestPayload>( ms_payload );
                            break;

                        case DepotManifest.PROTOBUF_METADATA_MAGIC:
                            uint metadata_length = br.ReadUInt32();
                            byte[] metadata_bytes = br.ReadBytes( (int)metadata_length );
                            using ( var ms_metadata = new MemoryStream( metadata_bytes ) )
                                metadata = Serializer.Deserialize<ContentManifestMetadata>( ms_metadata );
                            break;

                        case DepotManifest.PROTOBUF_SIGNATURE_MAGIC:
                            uint signature_length = br.ReadUInt32();
                            byte[] signature_bytes = br.ReadBytes( (int)signature_length );
                            using ( var ms_signature = new MemoryStream( signature_bytes ) )
                                signature = Serializer.Deserialize<ContentManifestSignature>( ms_signature );
                            break;

                        case DepotManifest.PROTOBUF_ENDOFMANIFEST_MAGIC:
                            break;

                        default:
                            throw new NotImplementedException( string.Format( "Unrecognized magic value {0:X} in depot manifest.", magic ) );
                    }
                }
            }

            if (payload != null && metadata != null && signature != null)
            {
                ParseProtobufManifestMetadata(metadata);
                ParseProtobufManifestPayload(payload);
            }
            else
            {
                throw new InvalidDataException("Missing ContentManifest sections required for parsing depot manifest");
            }
        }
示例#8
0
        void InternalDeserialize(byte[] data)
        {
            ContentManifestPayload?  payload   = null;
            ContentManifestMetadata? metadata  = null;
            ContentManifestSignature?signature = null;

            using (var ms = new MemoryStream(data))
                using (var br = new BinaryReader(ms))
                {
                    while ((ms.Length - ms.Position) > 0)
                    {
                        uint magic = br.ReadUInt32();

                        switch (magic)
                        {
                        case Steam3Manifest.MAGIC:
                            ms.Seek(-4, SeekOrigin.Current);
                            Steam3Manifest binaryManifest = new Steam3Manifest(br);
                            ParseBinaryManifest(binaryManifest);

                            uint marker = br.ReadUInt32();
                            if (marker != magic)
                            {
                                throw new InvalidDataException("Unable to find end of message marker for depot manifest");
                            }
                            break;

                        case DepotManifest.PROTOBUF_PAYLOAD_MAGIC:
                            uint   payload_length = br.ReadUInt32();
                            byte[] payload_bytes  = br.ReadBytes((int)payload_length);
                            using (var ms_payload = new MemoryStream(payload_bytes))
                                payload = Serializer.Deserialize <ContentManifestPayload>(ms_payload);
                            break;

                        case DepotManifest.PROTOBUF_METADATA_MAGIC:
                            uint   metadata_length = br.ReadUInt32();
                            byte[] metadata_bytes  = br.ReadBytes((int)metadata_length);
                            using (var ms_metadata = new MemoryStream(metadata_bytes))
                                metadata = Serializer.Deserialize <ContentManifestMetadata>(ms_metadata);
                            break;

                        case DepotManifest.PROTOBUF_SIGNATURE_MAGIC:
                            uint   signature_length = br.ReadUInt32();
                            byte[] signature_bytes  = br.ReadBytes((int)signature_length);
                            using (var ms_signature = new MemoryStream(signature_bytes))
                                signature = Serializer.Deserialize <ContentManifestSignature>(ms_signature);
                            break;

                        case DepotManifest.PROTOBUF_ENDOFMANIFEST_MAGIC:
                            break;

                        default:
                            throw new InvalidDataException($"Unrecognized magic value {magic:X} in depot manifest.");
                        }
                    }
                }

            if (payload != null && metadata != null && signature != null)
            {
                ParseProtobufManifestMetadata(metadata);
                ParseProtobufManifestPayload(payload);
            }
            else
            {
                throw new InvalidDataException("Missing ContentManifest sections required for parsing depot manifest");
            }
        }
示例#9
0
        void Deserialize(byte[] data)
        {
            using ( var ms = new MemoryStream( data ) )
            using ( var br = new BinaryReader( ms ) )
            {
                while ( ( ms.Length - ms.Position ) > 0 )
                {
                    uint magic = br.ReadUInt32();
                    ms.Seek( -4, SeekOrigin.Current );

                    switch ( magic )
                    {
                        case Steam3Manifest.MAGIC:
                            Steam3Manifest binaryManifest = new Steam3Manifest( br );
                            ParseBinaryManifest( binaryManifest );
                            break;

                            // todo: handle protobuf manifest?

                        default:
                            throw new NotImplementedException( string.Format( "Unrecognized magic value {0:X} in depot manifest.", magic ) );
                    }

                    uint marker = br.ReadUInt32();
                    if ( marker != magic )
                        throw new InvalidDataException( "Unable to find end of message marker for depot manifest" );
                }
            }
        }