private static bool InternalGenerateThumbnail(ImageViewModel target, DataOperationUnit dataOpUnit) { lock (target) { //暗号化している場合は無視する if (!Configuration.ApplicationConfiguration.LibraryIsEncrypted && !File.Exists(target.AbsoluteMasterPath)) { throw new FileNotFoundException(target.AbsoluteMasterPath); } var thumbnail = new ThumbnailViewModel(); thumbnail.ID = target.ID; thumbnail.ImageID = target.ID; var encryptImage = EncryptImageFacade.FindBy(target.ID); if (encryptImage != null) { //暗号化実施時はサムネイル画像を出力しない s_logger.Info($"Sunctum will not output a thumbnail image because it is in encrypted. {target.ID}"); } else { try { thumbnail.RelativeMasterPath = ThumbnailGenerator.SaveThumbnail(target.AbsoluteMasterPath, target.ID.ToString("N") + System.IO.Path.GetExtension(target.AbsoluteMasterPath)); } catch (Exception e) { s_logger.Warn(e); return(false); } s_logger.Debug($"Generate thumbnail ImageID={target.ID}"); } Task.Factory.StartNew(() => RecordThumbnail(thumbnail)); //Apply thumbnail target.Thumbnail = thumbnail; return(true); } }