示例#1
0
        public override void EndWrite(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            if (!async)
            {
                base.EndWrite(asyncResult);
                return;
            }

            AsyncResult ares = asyncResult as AsyncResult;

            if (ares == null)
            {
                throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
            }

            WriteDelegate w = ares.AsyncDelegate as WriteDelegate;

            if (w == null)
            {
                throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
            }

            w.EndInvoke(asyncResult);
            return;
        }
示例#2
0
        public override void EndWrite(IAsyncResult asyncResult)
        {
            AsyncResult   result = (AsyncResult)asyncResult;
            WriteDelegate caller = (WriteDelegate)result.AsyncDelegate;

            caller.EndInvoke(asyncResult);
        }
示例#3
0
        public override void EndWrite(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            AsyncResult ar = asyncResult as AsyncResult;

            if (ar == null)
            {
                throw new ArgumentException("Invalid asyncResult.", "asyncResult");
            }

            WriteDelegate del = ar.AsyncDelegate as WriteDelegate;

            if (del == null)
            {
                throw new ArgumentException("Invalid asyncResult.", "asyncResult");
            }

#if SSHARP
            del.EndInvokeEx(asyncResult);
#else
            del.EndInvoke(asyncResult);
#endif
        }
示例#4
0
        private static void EndWrite(IAsyncResult ar)
        {
            HidAsyncState hidAsyncState = (HidAsyncState)ar.AsyncState;
            WriteDelegate writeDelegate = (WriteDelegate)hidAsyncState.CallerDelegate;
            WriteCallback writeCallback = (WriteCallback)hidAsyncState.CallbackDelegate;
            bool          success       = writeDelegate.EndInvoke(ar);

            writeCallback?.Invoke(success);
        }
示例#5
0
 private void WriteCallback(IAsyncResult ar)
 {
     try
     {
         AsyncResult   result = (AsyncResult)ar;
         WriteDelegate caller = (WriteDelegate)result.AsyncDelegate;
         caller.EndInvoke(ar);
     }
     catch (Exception)
     {
         Close();
     }
 }
示例#6
0
        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");
            }
            WriteDelegate writeDelegate = asyncResult2.AsyncDelegate as WriteDelegate;

            if (writeDelegate == null)
            {
                throw new ArgumentException("Invalid asyncResult.", "asyncResult");
            }
            writeDelegate.EndInvoke(asyncResult);
        }
        public override void EndWrite(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            AsyncResult ar = asyncResult as AsyncResult;

            if (ar == null)
            {
                throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
            }

            WriteDelegate d = ar.AsyncDelegate as WriteDelegate;

            if (d == null)
            {
                throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
            }

            d.EndInvoke(asyncResult);
        }
示例#8
0
 public override void EndWrite(IAsyncResult asyncResult)
 {
     writeDelegate.EndInvoke(asyncResult);
 }