public override int EndRead(IAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentNullException("asyncResult"); } AsyncResult asyncResult2 = asyncResult as AsyncResult; if (asyncResult2 == null) { throw new ArgumentException("Invalid asyncResult", "asyncResult"); } FtpDataStream.ReadDelegate readDelegate = asyncResult2.AsyncDelegate as FtpDataStream.ReadDelegate; if (readDelegate == null) { throw new ArgumentException("Invalid asyncResult", "asyncResult"); } return(readDelegate.EndInvoke(asyncResult)); }
public override IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback cb, object state) { this.CheckDisposed(); if (!this.isRead) { throw new NotSupportedException(); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (offset < 0 || offset > buffer.Length) { throw new ArgumentOutOfRangeException("offset"); } if (size < 0 || size > buffer.Length - offset) { throw new ArgumentOutOfRangeException("offset+size"); } FtpDataStream.ReadDelegate readDelegate = new FtpDataStream.ReadDelegate(this.ReadInternal); return(readDelegate.BeginInvoke(buffer, offset, size, cb, state)); }