public bool Embed(IEnumerable <T> target, BitReader bitReader) { foreach (var item in target) { var hasDataLeftToEmbed = _itemSteganographer.Embed(item, bitReader); if (!hasDataLeftToEmbed) { return(false); } } return(true); }
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 bool Embed(TInput target, BitReader bitReader) { return(_innerSteganographer.Embed((TOutput)target, bitReader)); }