public static FileEntryVersion ConvertCurrentErrorHistorical(FileEntryVersion fileEntryVersion) { switch (fileEntryVersion) { case FileEntryVersion.MetadataToSave: case FileEntryVersion.CompatibilityFixedAndAutoUpdated: case FileEntryVersion.CurrentVersionInDatabase: case FileEntryVersion.ExtractedNowUsingExiftool: case FileEntryVersion.ExtractedNowUsingReadMediaFile: case FileEntryVersion.ExtractedNowUsingWindowsLivePhotoGallery: case FileEntryVersion.ExtractedNowUsingMicrosoftPhotos: case FileEntryVersion.ExtractedNowUsingWebScraping: return(FileEntryVersion.CurrentVersionInDatabase); case FileEntryVersion.ExtractedNowUsingExiftoolFileNotExist: case FileEntryVersion.ExtractedNowUsingExiftoolTimeout: case FileEntryVersion.ExtractedNowUsingExiftoolWithError: case FileEntryVersion.Error: return(FileEntryVersion.Error); case FileEntryVersion.Historical: return(FileEntryVersion.Historical); case FileEntryVersion.NotAvailable: default: throw new NotImplementedException(); } }
public static bool IsCurrenOrUpdatedVersion(FileEntryVersion fileEntryVersion) { return (fileEntryVersion == FileEntryVersion.CurrentVersionInDatabase || fileEntryVersion == FileEntryVersion.CompatibilityFixedAndAutoUpdated || fileEntryVersion == FileEntryVersion.MetadataToSave || fileEntryVersion == FileEntryVersion.ExtractedNowUsingExiftool || fileEntryVersion == FileEntryVersion.ExtractedNowUsingReadMediaFile || fileEntryVersion == FileEntryVersion.ExtractedNowUsingWindowsLivePhotoGallery || fileEntryVersion == FileEntryVersion.ExtractedNowUsingMicrosoftPhotos || fileEntryVersion == FileEntryVersion.ExtractedNowUsingWebScraping); }
/// <summary> /// Load a Thumbnail for given file for last written datetime /// 1. Read first from database and return Thumbnail /// If not found, then read from file /// 1. Then try load from Cover Art /// 2. Then read full media and create thumbnail /// 3. ---- Add MediaFile to Thread Qeueu with image as Parameter --- /// /// Error handling: /// When faild loading, and error image will be return. /// </summary> /// <param name="fileEntry"></param> /// <returns></returns> private Image GetThumbnailFromDatabaseUpdatedDatabaseIfNotExist(FileEntry fileEntry, bool dontReadFilesInCloud, FileStatus fileStatus) { FileEntryVersion fileEntryVersion = FileEntryVersion.ExtractedNowUsingExiftool; Image thumbnailImage; thumbnailImage = databaseAndCacheThumbnailPoster.ReadThumbnailFromCacheOrDatabase(fileEntry); if (thumbnailImage != null) { fileEntryVersion = FileEntryVersion.CurrentVersionInDatabase; } if (thumbnailImage == null) //Was not read from database or cache { if (fileStatus.IsInCloudOrVirtualOrOffline) { UpdateStatusAction("File is in Cloud, check if windows has thumbnail: " + fileEntry.FileFullPath); } else { UpdateStatusAction("Read thumbnail from file: " + fileEntry.FileFullPath); } thumbnailImage = LoadMediaCoverArtThumbnail(fileEntry.FileFullPath, ThumbnailSaveSize, fileStatus); if (thumbnailImage != null) { databaseAndCacheThumbnailPoster.ThumbnailCacheUpdate(fileEntry, new Bitmap(thumbnailImage)); //Remember the Thumbnail, before Save, for show in DataGridView etc., no need to load again DataGridView_UpdateColumnThumbnail_OnFileEntryAttribute(new FileEntryAttribute(fileEntry, fileEntryVersion), new Bitmap(thumbnailImage)); DataGridView_UpdateColumnThumbnail_OnFileEntryAttribute(new FileEntryAttribute(fileEntry, FileEntryVersion.Error), new Bitmap(thumbnailImage)); } else { //Start downloading in background from OneDrive if (!dontReadFilesInCloud && fileStatus.IsInCloudOrVirtualOrOffline) { FileHandler.TouchOfflineFileToGetFileOnline(fileEntry.FileFullPath); } } AddQueueSaveToDatabaseMediaThumbnailLock( new FileEntryImage( fileEntry, thumbnailImage == null ? null : new Bitmap(thumbnailImage), !dontReadFilesInCloud )); } return(thumbnailImage); }
public static string ToStringShort(FileEntryVersion fileEntryVersion) { switch (fileEntryVersion) { case FileEntryVersion.MetadataToSave: return("Saving and Compatibility checked"); case FileEntryVersion.CompatibilityFixedAndAutoUpdated: return("AutoCorrected"); case FileEntryVersion.CurrentVersionInDatabase: return("Current"); case FileEntryVersion.ExtractedNowUsingExiftool: return("Exiftool extracted"); case FileEntryVersion.ExtractedNowUsingReadMediaFile: return("Extracted Poster"); case FileEntryVersion.ExtractedNowUsingWindowsLivePhotoGallery: return("Extracted Windows Live Photo Gallery"); case FileEntryVersion.ExtractedNowUsingMicrosoftPhotos: return("Extracted Microsoft Photos"); case FileEntryVersion.ExtractedNowUsingWebScraping: return("Extracted WebScraping"); case FileEntryVersion.ExtractedNowUsingExiftoolTimeout: return("Exiftool timeout"); case FileEntryVersion.ExtractedNowUsingExiftoolFileNotExist: return("File not found"); case FileEntryVersion.ExtractedNowUsingExiftoolWithError: return("Exiftool with Error"); case FileEntryVersion.Error: return("Error"); case FileEntryVersion.Historical: return("Historical"); case FileEntryVersion.NotAvailable: default: throw new NotImplementedException(); } }
public static bool IsErrorOrHistoricalVersion(FileEntryVersion fileEntryVersion) { //fileEntryAttribute.FileEntryVersion != FileEntryVersion.AutoCorrect && fileEntryAttribute.FileEntryVersion != FileEntryVersion.Curren return(fileEntryVersion == FileEntryVersion.Historical || fileEntryVersion == FileEntryVersion.Error); }