/// <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; }
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(); } }
/// <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); }
public void EndWrite(IAsyncResult asyncResult) { DeflateStreamInstance.EndWrite(asyncResult); }