コード例 #1
0
ファイル: ThumbnailService.cs プロジェクト: mono/f-spot
		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);
		}
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        // 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")));
        }