public override void EndWrite(IAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentNullException("asyncResult"); } AsyncResult asyncResult2 = asyncResult as AsyncResult; if (asyncResult2 == null) { throw new ArgumentException("Invalid asyncResult.", "asyncResult"); } FtpDataStream.WriteDelegate writeDelegate = asyncResult2.AsyncDelegate as FtpDataStream.WriteDelegate; if (writeDelegate == null) { throw new ArgumentException("Invalid asyncResult.", "asyncResult"); } writeDelegate.EndInvoke(asyncResult); }
public override IAsyncResult BeginWrite(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.WriteDelegate writeDelegate = new FtpDataStream.WriteDelegate(this.WriteInternal); return(writeDelegate.BeginInvoke(buffer, offset, size, cb, state)); }