public static UInt64 ConvertToBytes(UInt64 value, InformationSize from) { return(from switch { InformationSize.Bit => value / BitInBytes, InformationSize.Byte => value, _ => value * ((UInt64)from / BitInBytes) });
public static Decimal ConvertInformation(Decimal value, InformationSize from, InformationSize to) { if (from == to) { return(value); } return(value * ((Decimal)from / (Decimal)to)); }
public static UInt64 ConvertInformation(UInt64 value, InformationSize from, InformationSize to) { if (from == to) { return(value); } return(value * ((UInt64)from / (UInt64)to)); }
public static Double ConvertInformation(Double value, InformationSize from, InformationSize to) { if (from == to) { return(value); } return(value * ((Double)from / (Double)to)); }
public static Decimal ConvertToBit(this InformationSize from, Decimal value) { return(ConvertToBit(value, from)); }
public static Decimal ConvertToBit(Decimal value, InformationSize from) { return(ConvertToBytes(value, from) * BitInBytes); }
public static Double ConvertToBit(this InformationSize from, Double value) { return(ConvertToBit(value, from)); }
public static Double ConvertInformation(this InformationSize from, Double value, InformationSize to) { return(ConvertInformation(value, from, to)); }
public static BandwidthStream <T> Bandwidth <T>([NotNull] this T stream, UInt64 speed = UInt64.MaxValue, InformationSize size = InformationSize.Byte) where T : Stream { if (stream is null) { throw new ArgumentNullException(nameof(stream)); } return(new BandwidthStream <T>(stream, speed, size)); }
public BandwidthStream(Stream stream, UInt64 speed, InformationSize size) : base(stream, speed, size) { }
public static UInt64 ConvertInformation(this InformationSize from, UInt64 value, InformationSize to) { return(ConvertInformation(value, from, to)); }
public static UInt64 ConvertInformation(Int64 value, InformationSize from, InformationSize to) { return(value > 0 ? ConvertInformation(from, (UInt64)value, to) : 0); }
public static UInt64 ConvertInformation(UInt32 value, InformationSize from, InformationSize to) { return(ConvertInformation((UInt64)value, from, to)); }
public static Decimal ConvertInformation(this InformationSize from, Decimal value, InformationSize to) { return(ConvertInformation(value, from, to)); }
public static UInt64 ConvertToBytes(Int64 value, InformationSize from) { return(value > 0 ? ConvertToBytes(from, (UInt64)value) : 0); }
public static UInt64 ConvertToBytes(this InformationSize from, Int64 value) { return(ConvertToBytes(value, from)); }
public static UInt64 ConvertToBit(this InformationSize from, UInt32 value) { return(ConvertToBit(value, from)); }
public BandwidthStream(Stream stream, Int32 speed, InformationSize size, IScheduler scheduler) : base(stream, speed, size, scheduler) { }
public static UInt64 ConvertToBit(Int64 value, InformationSize from) { return(value > 0 ? ConvertToBit((UInt64)value, from) : 0); }
public static BandwidthStream Bandwidth([NotNull] this Stream stream, Int32 speed, InformationSize size) { if (stream is null) { throw new ArgumentNullException(nameof(stream)); } return(new BandwidthStream(stream, speed, size)); }
public static UInt64 ConvertToBit(UInt64 value, InformationSize from) { return(ConvertToBytes(value, from) * BitInBytes); }
public static FileStream Reserve([NotNull] this FileStream stream, Int32 count, InformationSize type) { return(Reserve(stream, (Int64)type.ConvertToBytes(count))); }
public static Double ConvertToBit(Double value, InformationSize from) { return(ConvertToBytes(value, from) * BitInBytes); }