Ejemplo n.º 1
0
Archivo: Zip7.cs Proyecto: dnywu/sales
 public static byte[] Compress(byte[] inputBytes)
 {
     MemoryStream inStream = new MemoryStream(inputBytes);
     MemoryStream outStream = new MemoryStream();
     dokuku.sales.web.Compression.LZMA.Encoder encoder = new dokuku.sales.web.Compression.LZMA.Encoder();
     encoder.SetCoderProperties(propIDs, properties);
     encoder.WriteCoderProperties(outStream);
     long fileSize = inStream.Length;
     for (int i = 0; i < 8; i++)
         outStream.WriteByte((Byte)(fileSize >> (8 * i)));
     encoder.Code(inStream, outStream, -1, -1, null);
     return outStream.ToArray();
 }
Ejemplo n.º 2
0
        public static byte[] Compress(byte[] inputBytes)
        {
            MemoryStream inStream  = new MemoryStream(inputBytes);
            MemoryStream outStream = new MemoryStream();

            dokuku.sales.web.Compression.LZMA.Encoder encoder = new dokuku.sales.web.Compression.LZMA.Encoder();
            encoder.SetCoderProperties(propIDs, properties);
            encoder.WriteCoderProperties(outStream);
            long fileSize = inStream.Length;

            for (int i = 0; i < 8; i++)
            {
                outStream.WriteByte((Byte)(fileSize >> (8 * i)));
            }
            encoder.Code(inStream, outStream, -1, -1, null);
            return(outStream.ToArray());
        }