コード例 #1
0
        /// <summary>
        /// Завершение записи выходного потока
        /// </summary>
        /// <param name="result">result - содержит manualEvent</param>
        protected virtual void EndWriteCallBack(IAsyncResult result)
        {
            ManualResetEvent me = (ManualResetEvent)result.AsyncState;

            // Console.WriteLine("Write: Off={0} bytes={1}", offset, numBytes);
            if (compressType == CompressType.Deflate)
            {
                dfStream.EndWrite(result);
            }
            else
            {
                gzStream.EndWrite(result);
            }

            if (numBytes < bufSize)
            {
                // Это последний блок
                me.Set();
            }
            else
            {
                // Читаем дальше
                result = fsStream.BeginRead(buf, 0, bufSize, new AsyncCallback(EndReadCallBack), me);
            }
            offset += bufSize;
        }
コード例 #2
0
        private void WriteCallback(IAsyncResult ar)
        {
            DeflateStream s = (DeflateStream)ar.AsyncState;

            s.EndWrite(ar);
            try {
                // can we do something bad here ?
                Assert.IsNotNull(Environment.GetEnvironmentVariable("USERNAME"));
                message = "Expected a SecurityException";
            }
            catch (SecurityException) {
                message = null;
                reset.Set();
            }
            catch (Exception e) {
                message = e.ToString();
            }
        }
コード例 #3
0
ファイル: GZipStream.cs プロジェクト: Hengle/JellyTerain
 /// <summary>Handles the end of an asynchronous write operation.</summary>
 /// <param name="asyncResult">The <see cref="T:System.IAsyncResult" /> object that represents the asynchronous call.</param>
 /// <exception cref="T:System.InvalidOperationException">The underlying stream is null. -or-The underlying stream is closed.</exception>
 public override void EndWrite(IAsyncResult async_result)
 {
     deflateStream.EndWrite(async_result);
 }
コード例 #4
0
 public void EndWrite(IAsyncResult asyncResult)
 {
     DeflateStreamInstance.EndWrite(asyncResult);
 }