public ThumbnailService (IXdgDirectoryService xdgDirectoryService, IThumbnailerFactory thumbnailerFactory, IFileSystem fileSystem) { this.xdgDirectoryService = xdgDirectoryService; this.thumbnailerFactory = thumbnailerFactory; this.fileSystem = fileSystem; var large = new SafeUri(Path.Combine (xdgDirectoryService.GetThumbnailsDir (ThumbnailSize.Large))); if (!fileSystem.Directory.Exists (large)) fileSystem.Directory.CreateDirectory (large); var normal = new SafeUri(Path.Combine (xdgDirectoryService.GetThumbnailsDir (ThumbnailSize.Normal))); if (!fileSystem.Directory.Exists (normal)) fileSystem.Directory.CreateDirectory (normal); }
public ThumbnailService(IXdgDirectoryService xdgDirectoryService, IThumbnailerFactory thumbnailerFactory, IFileSystem fileSystem) { this.xdgDirectoryService = xdgDirectoryService; this.thumbnailerFactory = thumbnailerFactory; this.fileSystem = fileSystem; var large = new Uri(Path.Combine(xdgDirectoryService.GetThumbnailsDir(ThumbnailSize.Large))); if (!fileSystem.Directory.Exists(large)) { fileSystem.Directory.CreateDirectory(large); } var normal = new Uri(Path.Combine(xdgDirectoryService.GetThumbnailsDir(ThumbnailSize.Normal))); if (!fileSystem.Directory.Exists(normal)) { fileSystem.Directory.CreateDirectory(normal); } }
// TODO internal for unit testing with Moq public Uri GetThumbnailPath(Uri fileUri, ThumbnailSize size) { var fileHash = CryptoUtil.Md5Encode(fileUri.AbsoluteUri); return(new Uri(Path.Combine(xdgDirectoryService.GetThumbnailsDir(size), fileHash + ".png"))); }