public override IAsyncResult BeginRead(byte[] array, int offset, int count, AsyncCallback asyncCallback, object asyncState) {
IAsyncResult result2;
this.EnsureDecompressionMode();
if (this.asyncOperations != 0) {
throw new InvalidOperationException("Only one asynchronous reader is allowed time at one time.");
}
Interlocked.Increment(ref this.asyncOperations);
try {
this.ValidateParameters(array, offset, count);
DeflateStreamAsyncResult state = new DeflateStreamAsyncResult(this, asyncState, asyncCallback, array, offset, count);
state.isWrite = false;
int result = this.inflater.Inflate(array, offset, count);
if (result != 0) {
state.InvokeCallback(true, result);
return state;
}
if (this.inflater.Finished()) {
state.InvokeCallback(true, 0);
return state;
}
this._stream.BeginRead(this.buffer, 0, this.buffer.Length, this.m_CallBack, state);
state.m_CompletedSynchronously &= state.IsCompleted;
result2 = state;
}
catch {
Interlocked.Decrement(ref this.asyncOperations);
throw;
}
return result2;
}