Exemple #1
0
 public KeekStream(Stream innerStream, bool leaveInnerStreamOpen, bool isFragmented = false)
 {
     _innerStream          = innerStream ?? throw new ArgumentException(nameof(innerStream));
     _byteSender           = new TransparentByteSender(_innerStream);
     _leaveInnerStreamOpen = leaveInnerStreamOpen;
     _accumulator          = new ByteAccumulator();
     _readLock             = new object();
     _isFragmented         = isFragmented;
     _byteSender           = _isFragmented ?
                             (IByteSender) new TransparentByteSender(_innerStream) :
                             (IByteSender) new FragmentedByteSender(_innerStream);
 }
Exemple #2
0
        public LinkStream(
            string id,
            ByteAccumulator to,
            AutoResetEvent toSingal,
            ByteAccumulator from,
            AutoResetEvent fromSignal)
        {
            _to       = to;
            _toSignal = toSingal;

            _from       = from;
            _fromSignal = fromSignal;

            _lock = new object();
        }
Exemple #3
0
        public Link()
        {
            this.Id = Guid.NewGuid().ToString();

            _byteAccumulator1 = new ByteAccumulator();
            _byteAccumulator2 = new ByteAccumulator();
            _toSignal1        = new AutoResetEvent(false);
            _toSignal2        = new AutoResetEvent(false);

            _linkStream1 = new LinkStream(
                this.Id,
                _byteAccumulator1,
                _toSignal1,
                _byteAccumulator2,
                _toSignal2);

            _linkStream2 = new LinkStream(
                this.Id,
                _byteAccumulator2,
                _toSignal2,
                _byteAccumulator1,
                _toSignal1);
        }