public string ExtractFile(string DestinationDir, ManifestChunk Data) { var destPath = Path.Combine(DestinationDir, Data.Name); var data = Data.GetData(DataSource); Directory.CreateDirectory(Path.GetDirectoryName(destPath)); using (var file = File.Create(destPath)) file.Write(data, 0, data.Length); return destPath; }
private ManifestChunk GetChunk(long ManifestOffset, ulong DataOffset, out ulong EndDataOffset) { ManifestSource.Position = ManifestOffset; var chunk = new ManifestChunk(); byte[] nameLengthDat = new byte[4]; ManifestSource.Read(nameLengthDat, 0, 4); int nameLen = BitConverter.ToInt32(nameLengthDat, 0); byte[] byte1 = { 0, 0, 0, 0 }; // the chunk after the name byte[] size = { 0, 0, 0, 0 }; // the size of the chunk byte[] nameData = new byte[nameLen]; ManifestSource.Read(nameData, 0, nameLen); ManifestSource.Read(byte1, 0, 4); ManifestSource.Read(size, 0, 4); chunk.Name = Encoding.ASCII.GetString(nameData); chunk.Offset = DataOffset; int cSize = BitConverter.ToInt32(size, 0); chunk.EndOffset = EndDataOffset = DataOffset + (ulong)cSize; chunk.Extra = BitConverter.ToInt32(byte1, 0); return chunk; }