コード例 #1
0
            // Decompressed the data in this block
            public byte[] Decompress()
            {
                var decompressed = new byte[UncompressedSize];

                using var lzmaStream = new LzmaStream(Properites, new MemoryStream(CompressedData));

                lzmaStream.Read(decompressed, 0, decompressed.Length);
                return(decompressed);
            }
コード例 #2
0
        private static void DecompressLzma(Stream compressed, Stream target)
        {
            var lzmaProperties = new byte[5];

            compressed.Seek(4, SeekOrigin.Current);
            compressed.Read(lzmaProperties, 0, 5);
            var lzmaStream = new LzmaStream(lzmaProperties, compressed);
            int readBytes;
            var buffer = new byte[512];

            do
            {
                readBytes = lzmaStream.Read(buffer, 0, buffer.Length);
                target.Write(buffer, 0, readBytes);
            } while (readBytes > 0);
            target.Flush();
            target.Seek(0, SeekOrigin.Begin);
        }