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

            return OutPut.ToArray();
        }
Beispiel #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();
        }
Beispiel #3
0
        static public 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());
        }
Beispiel #4
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);
     }
 }
Beispiel #5
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());
     }
 }
Beispiel #6
0
        public static byte[] Decompress(byte[] Input)
        {
            byte[] Result = null;

            using (MemoryStream OutPut = new MemoryStream())
            {
                ZOutputStream ZStream = new ZOutputStream(OutPut);
                {
                    Process(ZStream, Input);
                    Result = OutPut.ToArray();
                }

                OutPut.Close();
            }

            return Result;
        }
Beispiel #7
0
        static public byte[] Decompress(byte[] Input)
        {
            byte[] Result = null;

            using (MemoryStream OutPut = new MemoryStream())
            {
                ZOutputStream ZStream = new ZOutputStream(OutPut);
                {
                    Process(ZStream, Input);
                    Result = OutPut.ToArray();
                }

                OutPut.Close();
            }

            return(Result);
        }
Beispiel #8
0
        public static byte[] Compress(byte[] Input,int Compression,int Flush)
        {
            byte[] Result = null;

            using (MemoryStream OutPut = new MemoryStream())
            {
                ZOutputStream ZStream = new ZOutputStream(OutPut, Compression);
                {
                    ZStream.FlushMode = Flush;
                    Process(ZStream, Input);
                    Result = OutPut.ToArray();
                }

                OutPut.Close();
            }

            return Result;
        }
Beispiel #9
0
        static public byte[] Compress(byte[] Input, int Compression, int Flush)
        {
            byte[] Result = null;

            using (MemoryStream OutPut = new MemoryStream())
            {
                ZOutputStream ZStream = new ZOutputStream(OutPut, Compression);
                {
                    ZStream.FlushMode = Flush;
                    Process(ZStream, Input);
                    Result = OutPut.ToArray();
                }

                OutPut.Close();
            }

            return(Result);
        }
Beispiel #10
0
 public void EnableSendCompress()
 {
     SendCompressed = true;
     OutCompress = new ZOutputStream(OutStream, zlibConst.Z_BEST_SPEED);
     OutCompress.FlushMode = zlibConst.Z_SYNC_FLUSH;
 }
Beispiel #11
0
 public void EnableReceiveCompress()
 {
     Crypted = true;
     ReceiveCompress = true;
     InCompress = new ZOutputStream(InStream);
     InCompress.FlushMode = zlibConst.Z_SYNC_FLUSH;
 }