Пример #1
0
        public static byte[] Decompress(byte[] data)
        {
            var inStream  = new MemoryStream(data);
            var outStream = new MemoryStream();

            var dec = new LZMA.Decoder();
            EasyCompressorProgress progress = null;

            if (ProgressUpdate != null)
            {
                progress = new EasyCompressorProgress(ProgressUpdate);
            }
            byte[] props = new byte[5];
            inStream.Read(props, 0, 5);
            dec.SetDecoderProperties(props);
            long outSize = 0;

            for (int i = 0; i < 8; i++)
            {
                outSize |= ((long)(byte)inStream.ReadByte()) << (8 * i);
            }
            long compressedSize = inStream.Length - inStream.Position;

            dec.Code(inStream, outStream, compressedSize, outSize, progress);
            inStream.Close();
            outStream.Close();
            return(outStream.ToArray());
        }
Пример #2
0
 public static byte[] Decompress(byte[] data)
 {
     var inStream = new MemoryStream(data);
     var outStream = new MemoryStream();
     
     var dec = new LZMA.Decoder();
     EasyCompressorProgress progress = null;
     if (ProgressUpdate != null)
         progress = new EasyCompressorProgress(ProgressUpdate);
     byte[] props = new byte[5];
     inStream.Read(props, 0, 5);
     dec.SetDecoderProperties(props);
     long outSize = 0;
     for (int i = 0; i < 8; i++)
         outSize |= ((long)(byte)inStream.ReadByte()) << (8 * i);
     long compressedSize = inStream.Length - inStream.Position;
     dec.Code(inStream, outStream, compressedSize, outSize, progress);
     inStream.Close();
     outStream.Close();
     return outStream.ToArray();
 }