예제 #1
0
 private void SerializeFile(BinaryWriter writer, ReleaseManifestFileEntry file)
 {
     writer.Write((UInt32)file.NameStringTableIndex);
     writer.Write((UInt32)file.ArchiveId);
     writer.Write((UInt64)file.ChecksumLow);
     writer.Write((UInt64)file.ChecksumHigh);
     writer.Write((UInt32)file.EntityType);
     writer.Write((UInt32)file.DecompressedSize);
     writer.Write((UInt32)file.CompressedSize);
     writer.Write((UInt32)file.Checksum2);
     writer.Write((UInt16)file.PatcherEntityType);
     writer.Write((byte)file.UnknownConstant1);
     writer.Write((byte)file.UnknownConstant2);
 }
예제 #2
0
        /// <summary>
        /// Deserializes the filesystem portion (directory and files) of a release manifest file.
        /// </summary>
        private void DeserializeFileSystemBody(
            BinaryReader reader,
            ReleaseManifest manifest,
            DeserializationContext context)
        {
            // - First load the directory block and treeify it ---------------------------------------
            reader.BaseStream.Position   = context.DirectoryTableDataOffset;
            context.DirectoryDescriptors = new ReleaseManifestDirectoryDescriptor[context.DirectoryTableCount];
            context.FileParentTable      = new ReleaseManifestDirectoryEntry[context.FileTableCount];
            context.DirectoryTable       = new ReleaseManifestDirectoryEntry[context.DirectoryTableCount];

            for (var i = 0; i < context.DirectoryTableCount; i++)
            {
                context.DirectoryDescriptors[i] = reader.ReadRMDirectoryDescriptor();
            }

            DeserializeTreeifyDirectoryDescriptor(0, context);
            manifest.Directories = new ReadOnlyCollection <ReleaseManifestDirectoryEntry>(context.DirectoryTable);
            manifest.Root        = context.DirectoryTable[0];

            // - Place the File Descriptors into our tree---------------------------------------------
            reader.BaseStream.Position = context.FileTableDataOffset;
            var files = new ReleaseManifestFileEntry[context.FileTableCount];

            for (var fileId = 0U; fileId < context.FileTableCount; fileId++)
            {
                var fileDescriptor = reader.ReadRMFileEntryDescriptor();
                files[fileId] = new ReleaseManifestFileEntry(
                    fileId,
                    manifest,
                    fileDescriptor,
                    context.FileParentTable[fileId]
                    );
            }

            manifest.Files = new ReadOnlyCollection <ReleaseManifestFileEntry>(files);
        }