public static byte[] Decompress(byte[] Input) { MemoryStream OutPut = new MemoryStream(); ZOutputStream ZStream = new ZOutputStream(OutPut); Process(ZStream,Input); return OutPut.ToArray(); }
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(); }
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()); } }
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()); } }
public void EnableSendCompress() { SendCompressed = true; OutCompress = new ZOutputStream(OutStream, zlibConst.Z_BEST_SPEED); OutCompress.FlushMode = zlibConst.Z_SYNC_FLUSH; }
public void EnableReceiveCompress() { Crypted = true; ReceiveCompress = true; InCompress = new ZOutputStream(InStream); InCompress.FlushMode = zlibConst.Z_SYNC_FLUSH; }