private void AnalyzeFiles(object sender, DoWorkEventArgs e) { var curFileInProgress = 0.0; foreach (string filePath in _jpegFilesLocation) { curFileInProgress++; ProcessedPhoto processedPhoto = Analyzer.ProcesImage(filePath, FilterNullValues); _resultSet.AddProcessedPhoto(processedPhoto); analysisWorker.ReportProgress((int)((curFileInProgress / _jpegFilesLocation.Count) * 100)); } }
public static ProcessedPhoto ProcesImage(string filePath, bool filterNullValues) { using (Image img = Image.FromFile(filePath)) { string filename = GetFilename(filePath); ProcessedPhoto processedPhoto = new ProcessedPhoto(); foreach (ExifProperties exifProperty in Enum.GetValues(typeof(ExifProperties))) { processedPhoto.Thumbnail = CreateImageThumbnail(img); int exifCode = Convert.ToInt32(exifProperty); string propertyValue = ParseExifTag(exifCode, img); if (filterNullValues && propertyValue == "Not Found") { continue; } processedPhoto.AddProperty(exifCode, propertyValue); } return(processedPhoto); } }