コード例 #1
0
 private void MultiLineResponseCallback(IAsyncResult asyncResult)
 {
     DataCommunicator.State state = (DataCommunicator.State)asyncResult.AsyncState;
     try
     {
         int num = state.DataStream.EndRead(asyncResult);
         if (num > 0)
         {
             state.AppendReceivedData(num);
             if (!this.LastLineReceived(state.Response))
             {
                 state.BeginRead();
                 return;
             }
         }
     }
     catch (InvalidOperationException exception)
     {
         if (base.Communicator.HasTimedOut)
         {
             base.Communicator.HandleException(DataCommunicator.CreateTimeoutException());
             return;
         }
         base.Communicator.HandleException(exception);
     }
     catch (IOException exception2)
     {
         base.Communicator.HandleException(exception2);
         return;
     }
     base.Communicator.StopTimer();
     state.LaunchResponseDelegate();
 }
コード例 #2
0
 protected void SingleLineResponseCallback(IAsyncResult asyncResult)
 {
     DataCommunicator.State state = (DataCommunicator.State)asyncResult.AsyncState;
     try
     {
         int num = state.DataStream.EndRead(asyncResult);
         if (num > 0)
         {
             state.AppendReceivedData(num);
             if (!state.Response.EndsWith("\r\n", StringComparison.Ordinal))
             {
                 state.BeginRead();
             }
         }
         this.Communicator.StopTimer();
         state.LaunchResponseDelegate();
     }
     catch (InvalidOperationException exception)
     {
         if (this.Communicator.HasTimedOut)
         {
             this.Communicator.HandleException(DataCommunicator.CreateTimeoutException());
         }
         else
         {
             this.Communicator.HandleException(exception);
         }
     }
     catch (IOException exception2)
     {
         this.Communicator.HandleException(exception2);
     }
 }
コード例 #3
0
ファイル: PopClient.cs プロジェクト: YHZX2013/exchange_diff
 internal void MultiLineResponseCallback(IAsyncResult asyncResult)
 {
     DataCommunicator.State state = (DataCommunicator.State)asyncResult.AsyncState;
     try
     {
         int num = state.DataStream.EndRead(asyncResult);
         if (num > 0)
         {
             state.AppendReceivedData(num);
             if (!PopClient.IsOkResponse(state.Response))
             {
                 if (!state.Response.EndsWith("\r\n", StringComparison.Ordinal))
                 {
                     state.ReadDataCallback = new AsyncCallback(base.SingleLineResponseCallback);
                     state.BeginRead();
                     return;
                 }
             }
             else
             {
                 bool flag = false;
                 if (!state.Response.EndsWith("\r\n.\r\n", StringComparison.Ordinal))
                 {
                     flag = true;
                 }
                 if (flag)
                 {
                     state.BeginRead();
                     return;
                 }
             }
         }
     }
     catch (InvalidOperationException exception)
     {
         if (base.Communicator.HasTimedOut)
         {
             base.Communicator.HandleException(DataCommunicator.CreateTimeoutException());
             return;
         }
         base.Communicator.HandleException(exception);
     }
     catch (IOException exception2)
     {
         base.Communicator.HandleException(exception2);
         return;
     }
     base.Communicator.StopTimer();
     state.LaunchResponseDelegate();
 }
コード例 #4
0
 internal void HandleException(Exception exception)
 {
     this.Close();
     if (this.ExceptionReporter == null)
     {
         throw new NullReferenceException("Handled exception reporter not found.", exception);
     }
     if (this.hasTimedOut)
     {
         this.exceptionReporter(DataCommunicator.CreateTimeoutException());
         return;
     }
     this.exceptionReporter(exception);
 }