当前位置: 首页>>代码示例>>C#>>正文


C# FlushType类代码示例

本文整理汇总了C#中FlushType的典型用法代码示例。如果您正苦于以下问题:C# FlushType类的具体用法?C# FlushType怎么用?C# FlushType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FlushType类属于命名空间,在下文中一共展示了FlushType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addHeaders

 private static void addHeaders(string fileName, long fileLength, object response, FlushType flushType)
 {
     var addHeader = response.GetType().GetMethod("AddHeader");
     addHeader.Invoke(response, new object[] { "Content-Length", fileLength.ToString(CultureInfo.InvariantCulture) });
     var contentDisposition = flushType == FlushType.Inline ? "inline;filename=" : "attachment;filename=";
     addHeader.Invoke(response, new object[] { "content-disposition", contentDisposition + fileName });
 }
开发者ID:VahidN,项目名称:PdfReport,代码行数:7,代码来源:SoftHttpContext.cs

示例2: Inflate

 public int Inflate(FlushType flush)
 {
     if (this.istate == null)
         throw new ZlibException("No Inflate State!");
     else
         return this.istate.Inflate(flush);
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:7,代码来源:ZlibCodec.cs

示例3: deflate

 public ZLibStatus deflate(FlushType flush)
 {
     if (dstate == null)
     {
         return ZLibStatus.Z_STREAM_ERROR;
     }
     return dstate.deflate(this, flush);
 }
开发者ID:eried,项目名称:RPiCustomizer,代码行数:8,代码来源:ZStream.cs

示例4: ZlibBaseStream

 public ZlibBaseStream(Stream stream, ZlibStreamFlavor flavor, bool leaveOpen)
 {
     this._flushMode = FlushType.None;
     this._stream = stream;
     this._leaveOpen = leaveOpen;
     this._flavor = flavor;
     if (flavor != ZlibStreamFlavor.GZIP)
         return;
     this.crc = new Crc32();
 }
开发者ID:liwq-net,项目名称:cocos2d-for-xna-windows,代码行数:10,代码来源:ZlibBaseStream.cs

示例5: ZlibBaseStream

 public ZlibBaseStream( Stream stream,
     CompressionMode compressionMode,
     CompressionLevel level,
     bool leaveOpen)
     : base()
 {
     this.flushMode = FlushType.None;
     this.stream = stream;
     this.leaveOpen = leaveOpen;
     this.compressionMode = compressionMode;
     this.level = level;
 }
开发者ID:Daramkun,项目名称:ProjectLiqueur,代码行数:12,代码来源:ZlibBaseStream.cs

示例6: ZlibBaseStream

 public ZlibBaseStream(System.IO.Stream stream, ZlibStreamFlavor flavor, bool leaveOpen)
     : base()
 {
     this._flushMode = FlushType.None;
     //this._workingBuffer = new byte[WORKING_BUFFER_SIZE_DEFAULT];
     this._stream = stream;
     this._leaveOpen = leaveOpen;
     this._flavor = flavor;
     // workitem 7159
     if (flavor == ZlibStreamFlavor.GZIP)
     {
         crc = new CRC32();
     }
 }
开发者ID:Kaidence,项目名称:ExchangeLINQ,代码行数:14,代码来源:ZLibStream.cs

示例7: FlushInBrowser

        /// <summary>
        /// Flushes the fileData into the user's browser.
        /// It's designed for the ASP.NET Applications.
        /// </summary>
        /// <param name="fileName">name of the file</param>
        /// <param name="fileData">byte array containing the file's data</param>
        /// <param name="flushType">How to flush an in memory PDF file</param>
        public static void FlushInBrowser(string fileName, byte[] fileData, FlushType flushType = FlushType.Attachment)
        {
            var fileLength = fileData.Length;

            var context = getCurrentHttpContext();
            var response = getCurrentResponse(context);
            setNoCache(response);
            setContentType(response);
            addHeaders(fileName, fileLength, response, flushType);
            setBufferTrue(response);
            clearResponse(response);
            writeToOutputStream(fileData, fileLength, response);
            responseEnd(response);
        }
开发者ID:VahidN,项目名称:PdfReport,代码行数:21,代码来源:SoftHttpContext.cs

示例8: ZlibBaseStream

 public ZlibBaseStream(Stream stream,
     CompressionMode compressionMode,
     CompressionLevel level,
     ZlibStreamFlavor flavor,
     bool leaveOpen)
 {
     this._flushMode = FlushType.None;
     //this._workingBuffer = new byte[WORKING_BUFFER_SIZE_DEFAULT];
     this._stream = stream;
     this._leaveOpen = leaveOpen;
     this._compressionMode = compressionMode;
     this._flavor = flavor;
     this._level = level;
     // workitem 7159
     if (flavor == ZlibStreamFlavor.GZIP) {
         this.crc = new CRC32();
     }
 }
开发者ID:virmitio,项目名称:coapp,代码行数:18,代码来源:ZlibBaseStream.cs

示例9: ZlibBaseStream

 public ZlibBaseStream(System.IO.Stream stream,
                       CompressionMode compressionMode,
                       CompressionLevel level,
                       ZlibStreamFlavor flavor,
                       bool leaveOpen,
                       int windowBits)
     : base()
 {
     this._flushMode = FlushType.None;
     //this._workingBuffer = new byte[WORKING_BUFFER_SIZE_DEFAULT];
     this._stream = stream;
     this._leaveOpen = leaveOpen;
     this._compressionMode = compressionMode;
     this._flavor = flavor;
     this._level = level;
     this.windowBitsMax = windowBits;
     // workitem 7159
     if (flavor == ZlibStreamFlavor.GZIP)
     {
         this.crc = new BestHTTP.Decompression.Crc.CRC32();
     }
 }
开发者ID:JohnMalmsteen,项目名称:mobile-apps-tower-defense,代码行数:22,代码来源:ZlibBaseStream.cs

示例10: Inflate

 /// <summary>
 /// Inflate the data in the InputBuffer, placing the result in the OutputBuffer.
 /// </summary>
 /// <remarks>
 /// You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and 
 /// AvailableBytesOut  before calling this method.
 /// </remarks>
 /// <example>
 /// <code>
 /// private void InflateBuffer()
 /// {
 ///     int bufferSize = 1024;
 ///     byte[] buffer = new byte[bufferSize];
 ///     ZlibCodec decompressor = new ZlibCodec();
 /// 
 ///     Console.WriteLine("\n============================================");
 ///     Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length);
 ///     MemoryStream ms = new MemoryStream(DecompressedBytes);
 /// 
 ///     int rc = decompressor.InitializeInflate();
 /// 
 ///     decompressor.InputBuffer = CompressedBytes;
 ///     decompressor.NextIn = 0;
 ///     decompressor.AvailableBytesIn = CompressedBytes.Length;
 /// 
 ///     decompressor.OutputBuffer = buffer;
 /// 
 ///     // pass 1: inflate 
 ///     do
 ///     {
 ///         decompressor.NextOut = 0;
 ///         decompressor.AvailableBytesOut = buffer.Length;
 ///         rc = decompressor.Inflate(FlushType.None);
 /// 
 ///         if (rc != ZlibConstants.Z_OK &amp;&amp; rc != ZlibConstants.Z_STREAM_END)
 ///             throw new Exception("inflating: " + decompressor.Message);
 /// 
 ///         ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut);
 ///     }
 ///     while (decompressor.AvailableBytesIn &gt; 0 || decompressor.AvailableBytesOut == 0);
 /// 
 ///     // pass 2: finish and flush
 ///     do
 ///     {
 ///         decompressor.NextOut = 0;
 ///         decompressor.AvailableBytesOut = buffer.Length;
 ///         rc = decompressor.Inflate(FlushType.Finish);
 /// 
 ///         if (rc != ZlibConstants.Z_STREAM_END &amp;&amp; rc != ZlibConstants.Z_OK)
 ///             throw new Exception("inflating: " + decompressor.Message);
 /// 
 ///         if (buffer.Length - decompressor.AvailableBytesOut &gt; 0)
 ///             ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut);
 ///     }
 ///     while (decompressor.AvailableBytesIn &gt; 0 || decompressor.AvailableBytesOut == 0);
 /// 
 ///     decompressor.EndInflate();
 /// }
 ///
 /// </code>
 /// </example>
 /// <param name="flush">The flush to use when inflating.</param>
 /// <returns>Z_OK if everything goes well.</returns>
 internal int Inflate(FlushType flush)
 {
     if (istate == null)
         throw new ZlibException("No Inflate State!");
     return istate.Inflate(flush);
 }
开发者ID:Cardanis,项目名称:MonoGame,代码行数:69,代码来源:ZlibStream.cs

示例11: deflate

 public ZLibStatus deflate(byte[] bufer, int offset, int count, byte[] p1, int p2, int p3, FlushType flushType)
 {
     throw new NotImplementedException();
 }
开发者ID:imbavirus,项目名称:TrinityCoreAdmin,代码行数:4,代码来源:Inflate.cs

示例12: inflate

        public ZLibStatus inflate(FlushType ff)
        {
            ZLibStatus r;
            int b;

            if (base.next_in == null)
                return ZLibStatus.Z_STREAM_ERROR;
            var f = ff == FlushType.Z_FINISH ? ZLibStatus.Z_BUF_ERROR : ZLibStatus.Z_OK;
            r = ZLibStatus.Z_BUF_ERROR;
            while (true)
            {
                //System.out.println("mode: "+this.mode);
                switch (this._mode)
                {
                    case InflateMode.METHOD:

                        if (base.avail_in == 0) return r; r = f;

                        base.avail_in--; base.total_in++;
                        if (((this.method = base.next_in[base.next_in_index++]) & 0xf) != Z_DEFLATED)
                        {
                            this._mode = InflateMode.BAD;
                            base.msg = "unknown compression method";
                            this._marker = 5;       // can't try inflateSync
                            break;
                        }
                        if ((this.method >> 4) + 8 > this._wbits)
                        {
                            this._mode = InflateMode.BAD;
                            base.msg = "invalid window size";
                            this._marker = 5;       // can't try inflateSync
                            break;
                        }
                        this._mode = InflateMode.FLAG;
                        goto case InflateMode.FLAG;
                    case InflateMode.FLAG:

                        if (base.avail_in == 0) return r; r = f;

                        base.avail_in--; base.total_in++;
                        b = (base.next_in[base.next_in_index++]) & 0xff;

                        if ((((this.method << 8) + b) % 31) != 0)
                        {
                            this._mode = InflateMode.BAD;
                            base.msg = "incorrect header check";
                            this._marker = 5;       // can't try inflateSync
                            break;
                        }

                        if ((b & PRESET_DICT) == 0)
                        {
                            this._mode = InflateMode.BLOCKS;
                            break;
                        }
                        this._mode = InflateMode.DICT4;
                        goto case InflateMode.DICT4;
                    case InflateMode.DICT4:

                        if (base.avail_in == 0) return r; r = f;

                        base.avail_in--; base.total_in++;
                        this._need = ((base.next_in[base.next_in_index++] & 0xff) << 24) & 0xff000000L;
                        this._mode = InflateMode.DICT3;
                        goto case InflateMode.DICT3;
                    case InflateMode.DICT3:

                        if (base.avail_in == 0) return r; r = f;

                        base.avail_in--; base.total_in++;
                        this._need += ((base.next_in[base.next_in_index++] & 0xff) << 16) & 0xff0000L;
                        this._mode = InflateMode.DICT2;
                        goto case InflateMode.DICT2;
                    case InflateMode.DICT2:

                        if (base.avail_in == 0) return r; r = f;

                        base.avail_in--; base.total_in++;
                        this._need += ((base.next_in[base.next_in_index++] & 0xff) << 8) & 0xff00L;
                        this._mode = InflateMode.DICT1;
                        goto case InflateMode.DICT1;
                    case InflateMode.DICT1:

                        if (base.avail_in == 0) return r; r = f;

                        base.avail_in--; base.total_in++;
                        this._need += (base.next_in[base.next_in_index++] & 0xffL);
                        base.adler = this._need;
                        this._mode = InflateMode.DICT0;
                        return ZLibStatus.Z_NEED_DICT;
                    case InflateMode.DICT0:
                        this._mode = InflateMode.BAD;
                        base.msg = "need dictionary";
                        this._marker = 0;       // can try inflateSync
                        return ZLibStatus.Z_STREAM_ERROR;
                    case InflateMode.BLOCKS:

                        r = this._blocks.proc(this, r);
                        if (r == ZLibStatus.Z_DATA_ERROR)
                        {
//.........这里部分代码省略.........
开发者ID:imbavirus,项目名称:TrinityCoreAdmin,代码行数:101,代码来源:Inflate.cs

示例13: Deflate

        internal int Deflate(FlushType flush)
        {
            int old_flush;

            if (_codec.OutputBuffer == null ||
                (_codec.InputBuffer == null && _codec.AvailableBytesIn != 0) ||
                (status == FINISH_STATE && flush != FlushType.Finish))
            {
                _codec.Message = _ErrorMessage[ZlibConstants.Z_NEED_DICT - (ZlibConstants.Z_STREAM_ERROR)];
                throw new ZlibException(String.Format("Something is fishy. [{0}]", _codec.Message));
            }
            if (_codec.AvailableBytesOut == 0)
            {
                _codec.Message = _ErrorMessage[ZlibConstants.Z_NEED_DICT - (ZlibConstants.Z_BUF_ERROR)];
                throw new ZlibException("OutputBuffer is full (AvailableBytesOut == 0)");
            }

            old_flush = last_flush;
            last_flush = (int)flush;

            // Write the zlib (rfc1950) header bytes
            if (status == INIT_STATE)
            {
                int header = (Z_DEFLATED + ((w_bits - 8) << 4)) << 8;
                int level_flags = (((int)compressionLevel - 1) & 0xff) >> 1;

                if (level_flags > 3)
                    level_flags = 3;
                header |= (level_flags << 6);
                if (strstart != 0)
                    header |= PRESET_DICT;
                header += 31 - (header % 31);

                status = BUSY_STATE;
                //putShortMSB(header);
                unchecked
                {
                    pending[pendingCount++] = (byte)(header >> 8);
                    pending[pendingCount++] = (byte)header;
                }
                // Save the adler32 of the preset dictionary:
                if (strstart != 0)
                {
                    pending[pendingCount++] = (byte)((_codec._Adler32 & 0xFF000000) >> 24);
                    pending[pendingCount++] = (byte)((_codec._Adler32 & 0x00FF0000) >> 16);
                    pending[pendingCount++] = (byte)((_codec._Adler32 & 0x0000FF00) >> 8);
                    pending[pendingCount++] = (byte)(_codec._Adler32 & 0x000000FF);
                }
                _codec._Adler32 = Adler.Adler32(0, null, 0, 0);
            }

            // Flush as much pending output as possible
            if (pendingCount != 0)
            {
                _codec.flush_pending();
                if (_codec.AvailableBytesOut == 0)
                {
                    //System.out.println("  avail_out==0");
                    // Since avail_out is 0, deflate will be called again with
                    // more output space, but possibly with both pending and
                    // avail_in equal to zero. There won't be anything to do,
                    // but this is not an error situation so make sure we
                    // return OK instead of BUF_ERROR at next call of deflate:
                    last_flush = -1;
                    return ZlibConstants.Z_OK;
                }

                // Make sure there is something to do and avoid duplicate consecutive
                // flushes. For repeated and useless calls with Z_FINISH, we keep
                // returning Z_STREAM_END instead of Z_BUFF_ERROR.
            }
            else if (_codec.AvailableBytesIn == 0 &&
                     (int)flush <= old_flush &&
                     flush != FlushType.Finish)
            {
                // workitem 8557
                //
                // Not sure why this needs to be an error.  pendingCount == 0, which
                // means there's nothing to deflate.  And the caller has not asked
                // for a FlushType.Finish, but...  that seems very non-fatal.  We
                // can just say "OK" and do nothing.

                // _codec.Message = z_errmsg[ZlibConstants.Z_NEED_DICT - (ZlibConstants.Z_BUF_ERROR)];
                // throw new ZlibException("AvailableBytesIn == 0 && flush<=old_flush && flush != FlushType.Finish");

                return ZlibConstants.Z_OK;
            }

            // User must not provide more input after the first FINISH:
            if (status == FINISH_STATE && _codec.AvailableBytesIn != 0)
            {
                _codec.Message = _ErrorMessage[ZlibConstants.Z_NEED_DICT - (ZlibConstants.Z_BUF_ERROR)];
                throw new ZlibException("status == FINISH_STATE && _codec.AvailableBytesIn != 0");
            }

            // Start a new block or continue the current one.
            if (_codec.AvailableBytesIn != 0 || lookahead != 0 || (flush != FlushType.None && status != FINISH_STATE))
            {
                BlockState bstate = DeflateFunction(flush);

//.........这里部分代码省略.........
开发者ID:JohnMalmsteen,项目名称:mobile-apps-tower-defense,代码行数:101,代码来源:Deflate.cs

示例14: deflate_stored

        // Copy without compression as much as possible from the input stream, return
        // the current block state.
        // This function does not insert new strings in the dictionary since
        // uncompressible data is probably not useful. This function is used
        // only for the level=0 compression option.
        // NOTE: this function should be optimized to avoid extra copying from
        // window to pending_buf.
        private int deflate_stored(FlushType flush)
        {
            // Stored blocks are limited to 0xffff bytes, pending_buf is limited
            // to pending_buf_size, and each stored block has a 5 byte header:

            int max_block_size = 0xffff;
            int max_start;

            if (max_block_size > _pendingBufferSize - 5)
            {
                max_block_size = _pendingBufferSize - 5;
            }

            // Copy as much as possible from input to output:
            while (true)
            {
                // Fill the window as much as possible:
                if (_validBytesAhead <= 1)
                {
                    fill_window();
                    if (_validBytesAhead == 0 && flush == FlushType.Z_NO_FLUSH) return NeedMore;
                    if (_validBytesAhead == 0) break; // flush the current block
                }

                _startInsertString += _validBytesAhead;
                _validBytesAhead = 0;

                // Emit a stored block if pending_buf will be full:
                max_start = _blockStart + max_block_size;
                if (_startInsertString == 0 || _startInsertString >= max_start)
                {
                    // strstart == 0 is possible when wraparound on 16-bit machine
                    _validBytesAhead = (int)(_startInsertString - max_start);
                    _startInsertString = (int)max_start;

                    flush_block_only(false);
                    if (base.avail_out == 0) return NeedMore;

                }

                // Flush if we may have to slide, otherwise block_start may become
                // negative and the data will be gone:
                if (_startInsertString - _blockStart >= _windowSize - MIN_LOOKAHEAD)
                {
                    flush_block_only(false);
                    if (base.avail_out == 0) return NeedMore;
                }
            }

            flush_block_only(flush == FlushType.Z_FINISH);
            if (base.avail_out == 0)
                return (flush == FlushType.Z_FINISH) ? FinishStarted : NeedMore;

            return flush == FlushType.Z_FINISH ? FinishDone : BlockDone;
        }
开发者ID:imbavirus,项目名称:TrinityCoreAdmin,代码行数:62,代码来源:Deflate.cs

示例15: Inflate

 ///<summary>
 ///  Inflate the data in the InputBuffer, placing the result in the OutputBuffer.
 ///</summary>
 ///<remarks>
 ///  You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and AvailableBytesOut before calling this method.
 ///</remarks>
 ///<example>
 ///  <code>private void InflateBuffer()
 ///    {
 ///    int bufferSize = 1024;
 ///    byte[] buffer = new byte[bufferSize];
 ///    ZlibCodec decompressor = new ZlibCodec();
 /// 
 ///    Console.WriteLine("\n============================================");
 ///    Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length);
 ///    MemoryStream ms = new MemoryStream(DecompressedBytes);
 /// 
 ///    int rc = decompressor.InitializeInflate();
 /// 
 ///    decompressor.InputBuffer = CompressedBytes;
 ///    decompressor.NextIn = 0;
 ///    decompressor.AvailableBytesIn = CompressedBytes.Length;
 /// 
 ///    decompressor.OutputBuffer = buffer;
 /// 
 ///    // pass 1: inflate 
 ///    do
 ///    {
 ///    decompressor.NextOut = 0;
 ///    decompressor.AvailableBytesOut = buffer.Length;
 ///    rc = decompressor.Inflate(FlushType.None);
 /// 
 ///    if (rc != ZlibConstants.Z_OK &amp;&amp; rc != ZlibConstants.Z_STREAM_END)
 ///    throw new Exception("inflating: " + decompressor.Message);
 /// 
 ///    ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut);
 ///    }
 ///    while (decompressor.AvailableBytesIn &gt; 0 || decompressor.AvailableBytesOut == 0);
 /// 
 ///    // pass 2: finish and flush
 ///    do
 ///    {
 ///    decompressor.NextOut = 0;
 ///    decompressor.AvailableBytesOut = buffer.Length;
 ///    rc = decompressor.Inflate(FlushType.Finish);
 /// 
 ///    if (rc != ZlibConstants.Z_STREAM_END &amp;&amp; rc != ZlibConstants.Z_OK)
 ///    throw new Exception("inflating: " + decompressor.Message);
 /// 
 ///    if (buffer.Length - decompressor.AvailableBytesOut &gt; 0)
 ///    ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut);
 ///    }
 ///    while (decompressor.AvailableBytesIn &gt; 0 || decompressor.AvailableBytesOut == 0);
 /// 
 ///    decompressor.EndInflate();
 ///    }</code>
 ///</example>
 ///<param name="flush"> The flush to use when inflating. </param>
 ///<returns> Z_OK if everything goes well. </returns>
 public int Inflate(FlushType flush) {
     if (istate == null) {
         throw new ZlibException("No Inflate State!");
     }
     return istate.Inflate(flush);
 }
开发者ID:virmitio,项目名称:coapp,代码行数:65,代码来源:ZlibCodec.cs


注:本文中的FlushType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。