Ejemplo n.º 1
0
        public static byte[] Decompress(Stream input, int outputLength)
        {
            var decoder = new LZMADecoder();

            using (var output = new MemoryStream(outputLength))
            {
                input.Position += 4;
                var lzmaProperties = new byte[5];
                input.Read(lzmaProperties, 0, 5);

                decoder.SetDecoderProperties(lzmaProperties);
                decoder.Code(input, output, input.Length, outputLength, null);
                return(output.ToArray());
            }
        }
Ejemplo n.º 2
0
        public static byte[] DecompressBuffer(byte[] data, int bufferSize)
        {
            var lzmaDecoder = new LZMADecoder();
            using (var inStream = new MemoryStream(data))
            using (var outStream = new MemoryStream(bufferSize))
            {
                inStream.Position += 4;

                var lzmaProperties = new byte[5];
                inStream.Read(lzmaProperties, 0, 5);

                lzmaDecoder.SetDecoderProperties(lzmaProperties);
                lzmaDecoder.Code(inStream, outStream, inStream.Length, bufferSize, null);
                return outStream.ToArray();
            }
        }
Ejemplo n.º 3
0
        public static byte[] DecompressBuffer(byte[] data, int bufferSize)
        {
            var lzmaDecoder = new LZMADecoder();

            using (var inStream = new MemoryStream(data))
                using (var outStream = new MemoryStream(bufferSize))
                {
                    inStream.Position += 4;

                    var lzmaProperties = new byte[5];
                    inStream.Read(lzmaProperties, 0, 5);

                    lzmaDecoder.SetDecoderProperties(lzmaProperties);
                    lzmaDecoder.Code(inStream, outStream, inStream.Length, bufferSize, null);
                    return(outStream.ToArray());
                }
        }