public abstract Uri Identify(IRepository repository, Stream content, ITypedContent typedContent);
public override Uri Identify(IRepository repository, Stream originalContentStream, ITypedContent typedContent) { Stream contentStream = originalContentStream; string fileExtension = null; if (typedContent != null) { fileExtension = typedContent.FileExtension; Func <Stream, Stream> streamPreprocessorFunc; if (_StreamIdentifierPreprocessorFuncs.TryGetValue(typedContent.ContentType, out streamPreprocessorFunc)) { contentStream = streamPreprocessorFunc(originalContentStream); } } byte[] hash = _HashAlgorithm.ComputeHash(contentStream); string relativeUri = string.Concat( _Encoding .Encode( BitConverter.ToUInt64(hash, 0), false) .ToLower(), "-", _Encoding .Encode( BitConverter.ToUInt64(hash, 8), false) .ToLower()); for (int i = _FolderDepth; i > 0; i--) { relativeUri = relativeUri.Insert(i, Path.DirectorySeparatorChar.ToString()); } if (fileExtension != null) { relativeUri = Path.ChangeExtension(relativeUri, fileExtension); } return(new Uri(repository.Uri, relativeUri)); }