public static void EmbedStream <T>(this ISteganographer <T> steganographer, T target, Stream dataStream) where T : class { var targetCapacity = steganographer.CalculateBitCapacity(target) / 8; var requiredCapacity = sizeof(int) + dataStream.Length; if (requiredCapacity > targetCapacity) { throw new SteganographException($"The target does not have enough storage capacity, required:{requiredCapacity} bytes, available: {targetCapacity} bytes"); } var bitReader = new BitReader(dataStream); steganographer.Embed(target, bitReader); }
public long CalculateBitCapacity() => _steganographer.CalculateBitCapacity(_image);
public long CalculateBitCapacity(IEnumerable <T> target) { return(target.Sum(item => _itemSteganographer.CalculateBitCapacity(item))); }
public long CalculateBitCapacity(TInput target) { return(_innerSteganographer.CalculateBitCapacity((TOutput)target)); }