private ReleaseManifestDirectoryDescriptor ReadDirectoryDescriptor() { ReleaseManifestDirectoryDescriptor result = new ReleaseManifestDirectoryDescriptor(); result.NameIndex = _reader.ReadUInt32(); result.SubdirectoryStart = _reader.ReadUInt32(); result.SubdirectoryCount = _reader.ReadUInt32(); result.FileStart = _reader.ReadUInt32(); result.FileCount = _reader.ReadUInt32(); return(result); }
public ReleaseManifestDirectoryEntry(uint directoryId, ReleaseManifest manifest, ReleaseManifestDirectoryDescriptor descriptor, ReleaseManifestDirectoryEntry parent) { Id = directoryId; ReleaseManifest = manifest; Descriptor = descriptor; Parent = parent; if (parent != null) { parent.Directories.Add(this); } Directories = new List <ReleaseManifestDirectoryEntry>((int)descriptor.SubdirectoryCount); Files = new List <ReleaseManifestFileEntry>((int)descriptor.FileCount); }
public static ReleaseManifest Generate(string path, Dictionary <string, Archive> files, uint version) { var manifest = new ReleaseManifest(); manifest.FileLocation = path; manifest.Header = new ReleaseManifestHeader(); manifest.Header.EntityVersion = version; manifest.Header.FormatVersion = 65537; manifest.Header.Magic = 1297304658; manifest.Header.UnknownCount = 77266; //manifest.Directories = new ReleaseManifestDirectoryEntry[0]; //manifest.Files = new ReleaseManifestFileEntry[0]; //manifest.Strings = new StringTable(); manifest.SaveChanges(); var dirs = new List <ReleaseManifestDirectoryEntry>(); var descriptor = new ReleaseManifestDirectoryDescriptor(); new ReleaseManifestDirectoryEntry(0, manifest, descriptor, null); return(manifest); }
private void DeserializeTreeifyDirectoryDescriptor(uint directoryId, ReleaseManifestDirectoryEntry parent = null) { ReleaseManifestDirectoryDescriptor directoryDescriptor = _directoryDescriptors[directoryId]; ReleaseManifestDirectoryEntry directoryNode = new ReleaseManifestDirectoryEntry(directoryId, _manifest, directoryDescriptor, parent); _directoryTable[directoryId] = directoryNode; if (directoryDescriptor.FileCount != 0) { uint lastFileId = directoryDescriptor.FileStart + directoryDescriptor.FileCount; for (uint fileId = directoryDescriptor.FileStart; fileId < lastFileId; fileId++) { _fileParentTable[fileId] = directoryNode; } } uint lastSubdirectoryId = directoryDescriptor.SubdirectoryStart + directoryDescriptor.SubdirectoryCount; for (uint subDirectoryId = directoryDescriptor.SubdirectoryStart; subDirectoryId < lastSubdirectoryId; subDirectoryId++) { DeserializeTreeifyDirectoryDescriptor(subDirectoryId, directoryNode); } }