public static bool Write(this IBlockOutDevice me, IBlockInDevice source) { bool result = source.NotNull() && me.NotNull(); Collection.IVector<byte> data; while (result && !source.Empty && (data = source.Read()).NotNull() && data.Count > 0) result &= me.Write(data); return result; }
public static Generic.IEnumerator <Tasks.Task <Collection.IBlock <byte> > > GetEnumerator(this IBlockInDevice device) { yield return(device.Read()); }
protected BlockDeviceCombiner(IBlockInDevice inDevice, IBlockOutDevice outDevice) { this.inDevice = inDevice; this.outDevice = outDevice; }
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 BlockDeviceCombiner(IBlockInDevice inDevice) : this(inDevice, null) { }
public static IBlockDevice Wrap(IBlockInDevice inDevice, IBlockOutDevice outDevice) { return inDevice.NotNull() || outDevice.NotNull() ? new BlockDeviceCombiner(inDevice, outDevice) { Wrapped = true } : null; }
public static IBlockDevice Wrap(IBlockInDevice inDevice) { return BlockDeviceCombiner.Wrap(inDevice, null); }
public static IBlockDevice Open(IBlockInDevice inDevice, IBlockOutDevice outDevice) { return inDevice.NotNull() || outDevice.NotNull() ? new BlockDeviceCombiner(inDevice, outDevice) : null; }
public static IBlockDevice Open(IBlockInDevice inDevice) { return BlockDeviceCombiner.Open(inDevice, null); }