Пример #1
0
 internal object ReadResponse(NamedPipeClientStream stream, Type type, int InBufferSize = 8192)
 {
     using (AckStream ack = AckStream.Read(stream, type, InBufferSize))
     {
         if ((int)ack.State > (int)MessageState.Ok)
         {
             throw new Exception(ack.Message);
         }
         return(ack.Value);
     }
 }
Пример #2
0
 /// <summary>
 /// Read response from server.
 /// </summary>
 /// <typeparam name="TResponse"></typeparam>
 /// <param name="stream"></param>
 /// <param name="readTimeout"></param>
 /// <param name="InBufferSize"></param>
 /// <returns></returns>
 public TResponse ReadAck <TResponse>(NetworkStream stream, int readTimeout, int InBufferSize)
 {
     using (AckStream ack = AckStream.Read(stream, typeof(TResponse), readTimeout, InBufferSize))
     {
         if ((int)ack.State > (int)MessageState.Ok)
         {
             throw new MessageException(ack);
         }
         return(ack.GetValue <TResponse>());
     }
 }
Пример #3
0
 public TResponse ReadAck <TResponse>(NamedPipeClientStream stream, int InBufferSize = 8192)
 {
     using (AckStream ack = AckStream.Read(stream, typeof(TResponse), InBufferSize))
     {
         if ((int)ack.State > (int)MessageState.Ok)
         {
             throw new Exception(ack.Message);
         }
         return(ack.GetValue <TResponse>());
     }
 }
Пример #4
0
 /// <summary>
 /// Read response from server.
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="type"></param>
 /// <param name="readTimeout"></param>
 /// <param name="InBufferSize"></param>
 /// <returns></returns>
 public object ReadAck(NetworkStream stream, Type type, int readTimeout, int InBufferSize)
 {
     using (AckStream ack = AckStream.Read(stream, type, readTimeout, InBufferSize))
     {
         if ((int)ack.State > (int)MessageState.Ok)
         {
             throw new MessageException(ack);
         }
         return(ack.Value);
     }
 }