public void Unpack() { PacHeader header = _input.EnsureRead <PacHeader>(); header.Check(); PacEntry[] entries = _input.EnsureRead <PacEntry>(header.FileCount); Int64 dataPosition = _input.Position; for (Int32 index = 0; index < entries.Length; index++) { ref var entry = ref entries[index]; Boolean isCompressed = PacDecompressor.IsCompressed(entry.CompressionType); _input.SetPosition(dataPosition + entry.Offset); Span <Byte> data = _reader.Read(_input, entry.CompressedSize, entry.UncompressedSize, isCompressed); String outputPath = _pathBuilder.GetOutputPath(entry.RelativePath, entry.FileId); FileSystem.CreateFileDirectory(outputPath); using (var output = File.Create(outputPath)) output.Write(data); }
public static void Decompress(Stream input, Stream output, DataReader reader) { var decompressor = new PacDecompressor(input, output, reader); decompressor.Decompress(); }