Beispiel #1
0
 public static IByteDevice Wrap(IByteInDevice inDevice, IByteOutDevice outDevice)
 {
     return(inDevice.NotNull() || outDevice.NotNull() ? new ByteDeviceCombiner(inDevice, outDevice)
     {
         Wrapped = true
     } : null);
 }
Beispiel #2
0
        public virtual async Tasks.Task <bool> Close()
        {
            bool result;

            if (result = this.inDevice.NotNull() && !this.Wrapped)
            {
                result = await this.inDevice.Close();

                this.inDevice = null;
            }
            if (this.outDevice.NotNull() && !this.Wrapped)
            {
                result = await this.outDevice.Close();

                this.outDevice = null;
            }
            return(result);
        }
Beispiel #3
0
		public static ByteStream Wrap(IByteOutDevice device)
		{
			return ByteStream.Wrap(ByteDeviceCombiner.Open(device));
		}
		public virtual bool Close()
		{
			bool result;
			if (result = this.inDevice.NotNull() && !this.Wrapped)
			{
				this.inDevice.Close();
				this.inDevice = null;
			}
			if (this.outDevice.NotNull() && !this.Wrapped)
			{
				result |= this.outDevice.NotNull();
				this.outDevice.Close();
				this.outDevice = null;
			}
			return result;
		}
		protected ByteDeviceCombiner(IByteInDevice inDevice, IByteOutDevice outDevice)
		{
			this.inDevice = inDevice;
			this.outDevice = outDevice;
		}
		public static IByteDevice Wrap(IByteInDevice inDevice, IByteOutDevice outDevice)
		{
			return inDevice.NotNull() || outDevice.NotNull() ? new ByteDeviceCombiner(inDevice, outDevice) { Wrapped = true } : null;
		}
		public static IByteDevice Wrap(IByteOutDevice outDevice)
		{
			return ByteDeviceCombiner.Wrap(null, outDevice);
		}
		public static IByteDevice Open(IByteInDevice inDevice, IByteOutDevice outDevice)
		{
			return inDevice.NotNull() || outDevice.NotNull() ? new ByteDeviceCombiner(inDevice, outDevice) : null;
		}
		public static IByteDevice Open(IByteOutDevice outDevice)
		{
			return ByteDeviceCombiner.Open(null, outDevice);
		}
Beispiel #10
0
 protected ByteDeviceCombiner(IByteInDevice inDevice, IByteOutDevice outDevice)
 {
     this.inDevice  = inDevice;
     this.outDevice = outDevice;
 }
Beispiel #11
0
 public static IByteDevice Wrap(IByteOutDevice outDevice)
 {
     return(ByteDeviceCombiner.Wrap(null, outDevice));
 }
Beispiel #12
0
 public static IByteDevice Open(IByteInDevice inDevice, IByteOutDevice outDevice)
 {
     return(inDevice.NotNull() || outDevice.NotNull() ? new ByteDeviceCombiner(inDevice, outDevice) : null);
 }
Beispiel #13
0
 public static IByteDevice Open(IByteOutDevice outDevice)
 {
     return(ByteDeviceCombiner.Open(null, outDevice));
 }
		ChunkedBlockOutDevice(IByteOutDevice backend) :
			this((IOutDevice)backend)
		{
			this.backendWrite = backend.Write;
		}
		public static ChunkedBlockOutDevice Wrap(IByteOutDevice backend)
		{
			return backend.NotNull() ? new ChunkedBlockOutDevice(backend) { Wrapped = true } : null;
		}
		public static ChunkedBlockOutDevice Open(IByteOutDevice backend)
		{
			return backend.NotNull() ? new ChunkedBlockOutDevice(backend) : null;
		}