/// <summary>
        ///     Invoked on the background thread.
        /// </summary>
        /// <exception cref="SerializationException">An object in the graph of type parameter <typeparamref name="TRead"/> is not marked as serializable.</exception>
        private void ReadPipe()
        {
            try
            {
                Debug.WriteLine($"BEGIN Read Pipie:{Id}");


                while (ShutDown == false && IsConnected && _streamWrapper.CanRead)
                {
                    try
                    {
                        var obj = _streamWrapper.ReadObject();
                        if (obj == null)
                        {
                            CloseImpl();
                            return;
                        }

                        if (ReceiveMessage != null)
                        {
                            ReceiveMessage(this, obj);
                        }
                    }
                    catch
                    {
                        //we must igonre exception, otherwise, the namepipe wrapper will stop work.
                    }
                }
            }
            finally
            {
                Debug.WriteLine($"END Read Pipie:{Id}");
            }
        }
 /// <summary>
 ///     Invoked on the background thread.
 /// </summary>
 /// <exception cref="SerializationException">An object in the graph of type parameter <typeparamref name="TRead"/> is not marked as serializable.</exception>
 private void ReadPipe()
 {
     while (IsConnected && _streamWrapper.CanRead)
     {
         var obj = _streamWrapper.ReadObject();
         if (obj == null)
         {
             CloseImpl();
             return;
         }
         ReceiveMessage?.Invoke(this, obj);
     }
 }
Esempio n. 3
0
        /// <summary>
        ///     Invoked on the background thread.
        /// </summary>
        /// <exception cref="SerializationException">An object in the graph of type parameter <typeparamref name="TRead"/> is not marked as serializable.</exception>
        private void ReadPipe()
        {
            while (IsConnected && _streamWrapper.CanRead)
            {
                try
                {
                    var obj = _streamWrapper.ReadObject();
                    if (obj == null)
                    {
                        CloseImpl();
                        return;
                    }

                    ReceiveMessage?.Invoke(this, obj);
                }
                catch
                {
                    //we must ignore exception, otherwise, the named pipe wrapper will stop work.
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 ///     Invoked on the background thread.
 /// </summary>
 /// <exception cref="SerializationException">An object in the graph of type parameter <typeparamref name="TRead"/> is not marked as serializable.</exception>
 private void ReadPipe()
 {
     while (IsConnected && _streamWrapper.CanRead)
     {
         try
         {
             var obj = _streamWrapper.ReadObject();
             if (obj == null)
             {
                 CloseImpl();
                 return;
             }
             if (ReceiveMessage != null)
             {
                 ReceiveMessage(this, obj);
             }
         }
         catch (Exception ex)
         {
             //we must igonre exception, otherwise, the namepipe wrapper will stop work.
             this.OnError(ex);
         }
     }
 }
Esempio n. 5
0
 /// <summary>
 ///     Invoked on the background thread.
 /// </summary>
 /// <exception cref="SerializationException">An object in the graph of type parameter <typeparamref name="TRead"/> is not marked as serializable.</exception>
 private void ReadPipe()
 {
     while (IsConnected && _streamWrapper.CanRead)
     {
         try
         {
             var obj = _streamWrapper.ReadObject();
             if (obj == null)
             {
                 CloseImpl();
                 return;
             }
             if (ReceiveMessage != null)
             {
                 ReceiveMessage(this, obj);
             }
         }
         catch (Exception ex)
         {
             Logger.Write($"Exception reading pipe: {ex}");
             //we must ignore exception, otherwise, the namepipe wrapper will stop work.
         }
     }
 }