public void Extract(object instance, System.IO.Stream stream) { foreach (var element in (IEnumerable)instance) { _elementExtractor.Extract(element, stream); } }
public void HashData(object data) { if (!_byteExtractor.CanExtract(data.GetType())) { throw new InvalidOperationException("Cannot hash " + data.GetType()); } _byteExtractor.Extract(data, _stream); }
/// <inheritdoc /> public IHash Factory(object input) { if (!_byteExtractor.CanExtract(input.GetType())) { throw new ArgumentException(CannotHashMessage(input)); } using (var stream = new MemoryStream()) using (var safeStream = Stream.Synchronized(stream)) { _byteExtractor.Extract(input, safeStream); safeStream.Position = 0; return(new StreamHash(safeStream, _algorithmGenerator.Invoke())); } }