Esempio n. 1
0
        public static byte[] Decompress(byte[] Input)
        {
            MemoryStream OutPut = new MemoryStream();
            ZOutputStream ZStream = new ZOutputStream(OutPut);
            Process(ZStream,Input);

            return OutPut.ToArray();
        }
Esempio n. 2
0
        public static byte[] Compress(byte[] Input,int Compression,int Flush)
        {
            MemoryStream OutPut = new MemoryStream();
            ZOutputStream ZStream = new ZOutputStream(OutPut,Compression);
            ZStream.FlushMode = Flush;

            Process(ZStream,Input);

            return OutPut.ToArray();
        }
Esempio n. 3
0
 static private void Process(ZOutputStream ZStream, byte[] Input)
 {
     try
     {
         ZStream.Write(Input, 0, Input.Length);
         ZStream.Flush();
         ZStream.Close();
     }
     catch (Exception e)
     {
         Log.Error("Zlib", "Process Error : " + e.ToString());
     }
 }
Esempio n. 4
0
 private static void Process(ZOutputStream ZStream,byte[] Input)
 {
     try
     {
         ZStream.Write(Input, 0, Input.Length);
         ZStream.Flush();
         ZStream.Close();
     }
     catch (Exception e)
     {
         Log.Error("Zlib", "Process Error : " + e.ToString());
     }
 }
Esempio n. 5
0
 public void EnableSendCompress()
 {
     SendCompressed = true;
     OutCompress = new ZOutputStream(OutStream, zlibConst.Z_BEST_SPEED);
     OutCompress.FlushMode = zlibConst.Z_SYNC_FLUSH;
 }
Esempio n. 6
0
 public void EnableReceiveCompress()
 {
     Crypted = true;
     ReceiveCompress = true;
     InCompress = new ZOutputStream(InStream);
     InCompress.FlushMode = zlibConst.Z_SYNC_FLUSH;
 }