Example #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;
        }
Example #2
0
        public override void EndWrite(IAsyncResult asyncResult)
        {
            AsyncResult   result = (AsyncResult)asyncResult;
            WriteDelegate caller = (WriteDelegate)result.AsyncDelegate;

            caller.EndInvoke(asyncResult);
        }
Example #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
        }
Example #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);
        }
Example #5
0
 private void WriteCallback(IAsyncResult ar)
 {
     try
     {
         AsyncResult   result = (AsyncResult)ar;
         WriteDelegate caller = (WriteDelegate)result.AsyncDelegate;
         caller.EndInvoke(ar);
     }
     catch (Exception)
     {
         Close();
     }
 }
Example #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);
        }
Example #8
0
 public override void EndWrite(IAsyncResult asyncResult)
 {
     writeDelegate.EndInvoke(asyncResult);
 }