Example #1
0
 protected void Bhandle(byte[] data)
 {
     ThrowIfEnded();
     if (data == null)
     {
         return;
     }
     ProcessedBytes += data.LongLength;
     if (Paused)
     {
         Bwrite(data);
     }
     else if (PipedTo != null)
     {
         PipedTo.Write(data);
     }
     else if (_OnData != null)
     {
         _OnData(data);
     }
     else
     {
         Bwrite(data);
     }
 }
Example #2
0
 protected bool HandleReadable(byte[] source)
 {
     lock (Sync)
     {
         if (PipedTo != null)
         {
             if (!PipedTo.Write(source))
             {
                 OnFail?.Invoke();
             }
             return(true);
         }
         if (_OnData != null)
         {
             _OnData(source); return(true);
         }
         return(Readable.Write(source));
     }
 }