예제 #1
0
    public int inflateEnd()
    {
        if (istate == null)
        {
            return(-2);
        }
        int result = istate.inflateEnd(this);

        istate = null;
        return(result);
    }
예제 #2
0
        /// <summary>
        /// end inflate.
        /// </summary>
        internal int inflateEnd()
        {
            if (istate == null)
            {
                return(Z_STREAM_ERROR);
            }
            int ret = istate.inflateEnd(this);

            istate = null;
            return(ret);
        }
예제 #3
0
        public int InflateEnd()
        {
            if (Istate == null)
            {
                return(ZStreamError);
            }
            int ret = Istate.InflateEnd(this);

            Istate = null;
            return(ret);
        }
예제 #4
0
파일: zlib.cs 프로젝트: david50407/main
            public static Inflate /*!*/ AppendData(Inflate /*!*/ self, [DefaultProtocol] MutableString str)
            {
                var zst    = self.GetStream();
                int result = Process(zst, str, zlib.FlushStrategy.Z_NO_FLUSH, decompress, ref self.trailingUncompressedData);

                if (result != Z_OK && result != Z_STREAM_END)
                {
                    throw MakeError(result, zst.msg);
                }

                return(self);
            }
예제 #5
0
파일: zlib.cs 프로젝트: david50407/main
            public static MutableString /*!*/ SetDictionary(Inflate /*!*/ self, [NotNull] MutableString /*!*/ dictionary)
            {
                byte[] buffer = dictionary.ToByteArray();
                var    zst    = self.GetStream();
                int    err    = zst.inflateSetDictionary(buffer, buffer.Length);

                if (err != Z_OK)
                {
                    throw MakeError(err, zst.msg);
                }

                return(dictionary);
            }
예제 #6
0
        private void InsetPath()
        {
            var path = this.Children.OfType <IPathObject>().FirstOrDefault();

            if (path == null)
            {
                // clear our existing data
                VertexSource = new VertexStorage();
                return;
            }

            VertexSource = path.VertexSource.Offset(Inflate.Value(this), GetJoinType(Style));
        }
예제 #7
0
파일: zlib.cs 프로젝트: david50407/main
            public static MutableString /*!*/ InflateString(Inflate /*!*/ self, [DefaultProtocol] MutableString str)
            {
                MutableString uncompressed;

                var zst    = self.GetStream();
                int result = Process(zst, str, zlib.FlushStrategy.Z_SYNC_FLUSH, decompress, out uncompressed, ref self.trailingUncompressedData);

                if (result != Z_OK && result != Z_STREAM_END)
                {
                    throw MakeError(result, zst.msg);
                }

                return(uncompressed);
            }
예제 #8
0
파일: zlib.cs 프로젝트: david50407/main
 public static MutableString /*!*/ Flush(Inflate /*!*/ self)
 {
     return(InflateString(self, null));
 }
예제 #9
0
파일: ZLib.cs 프로젝트: nheng0/TenenoVPN
 public int inflateInit(int w)
 {
     istate = new Inflate();
     return istate.inflateInit(this, w);
 }
예제 #10
0
파일: ZLib.cs 프로젝트: nheng0/TenenoVPN
 public int inflateEnd()
 {
     if (istate == null)
         return Z_STREAM_ERROR;
     int ret = istate.inflateEnd(this);
     istate = null;
     return ret;
 }
예제 #11
0
            public static MutableString /*!*/ Read(GZipReader /*!*/ self)
            {
                Inflate z = new Inflate(-MAX_WBITS);

                return(Inflate.InflateStream(z, self._contents));
            }
예제 #12
0
 public static MutableString /*!*/ Close(Inflate /*!*/ self)
 {
     return(MutableString.CreateBinary(self._outputBuffer));
 }
예제 #13
0
            public static MutableString /*!*/ InflateStream(Inflate /*!*/ self, MutableString /*!*/ zstring)
            {
                self._inputBuffer.AddRange(zstring.ConvertToBytes());

                if (self._rawDeflate == false)
                {
                    byte compression_method_and_flags = self._inputBuffer[++(self._inPos)];
                    byte flags = self._inputBuffer[++(self._inPos)];
                    if (((compression_method_and_flags << (byte)0x08) + flags) % (byte)31 != 0)
                    {
                        throw new DataError("incorrect header check");
                    }

                    byte compression_method = (byte)(compression_method_and_flags & (byte)0x0F);
                    if (compression_method != Z_DEFLATED)
                    {
                        throw new DataError("unknown compression method");
                    }

                    byte compression_info = (byte)(compression_method_and_flags >> (byte)0x04);
                    if ((compression_info + 8) > self._wBits)
                    {
                        throw new DataError("invalid window size");
                    }

                    bool preset_dictionary_flag = ((flags & 0x20) >> 0x05 == 1);
                    byte compression_level      = (byte)((flags & 0xC0) >> (byte)0x06);

                    //TODO: Add Preset Dictionary Support
                    if (preset_dictionary_flag)
                    {
                        self._inPos += 4;
                    }
                }

                bool last_block = false;

                while (!last_block)
                {
                    last_block = (self.GetBits(1) == 1);
                    byte block_type = (byte)self.GetBits(2);
                    switch (block_type)
                    {
                    case 0:
                        self.NoCompression();
                        break;

                    case 1:
                        self.FixedCodes();
                        break;

                    case 2:
                        self.DynamicCodes();
                        break;

                    case 3:
                        throw new DataError("invalid block type");
                    }
                }

                return(Inflate.Close(self));
            }
예제 #14
0
 /// <summary>
 /// init inflate with size.
 /// </summary>
 internal int inflateInit(int w)
 {
     istate = new Inflate();
     return(istate.inflateInit(this, w));
 }
예제 #15
0
 public int InflateInit(int w, bool nowrap)
 {
     Istate = new Inflate();
     return(Istate.InflateInit(this, nowrap ? -w : w));
 }
예제 #16
0
 public int Init(int w, bool nowrap)
 {
     //finished = false;
     istate = new Inflate(this);
     return(istate.InflateInit(nowrap ? -w : w));
 }
예제 #17
0
 public int inflateInit(int w, bool nowrap)
 {
     istate = new Inflate();
     return(istate.inflateInit(this, nowrap ? (-w) : w));
 }