Esempio n. 1
0
        public string ReadStringZT(Encoding encoding, byte size)
        {
            PrimitiveBuffer buffer = new PrimitiveBuffer();
            ulong           block  = size / 8u;

            while (true)
            {
                byte[] read = NonBlockingUnsafeRead(block);
                if (read == null || read.All((v) => v == 0))
                {
                    break;
                }
                buffer.Write(read);
            }
            return(encoding.GetString(buffer.Read(buffer.Length)));
        }
Esempio n. 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));
     }
 }