예제 #1
0
 void ParseProtobufManifestMetadata(ContentManifestMetadata metadata)
 {
     FilenamesEncrypted    = metadata.filenames_encrypted;
     DepotID               = metadata.depot_id;
     ManifestGID           = metadata.gid_manifest;
     CreationTime          = DateUtils.DateTimeFromUnixTime(metadata.creation_time);
     TotalUncompressedSize = metadata.cb_disk_original;
     TotalCompressedSize   = metadata.cb_disk_compressed;
 }
예제 #2
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");
            }
        }
예제 #3
0
 void ParseProtobufManifestMetadata(ContentManifestMetadata metadata)
 {
     FilenamesEncrypted = metadata.filenames_encrypted;
 }