/// <summary> /// Examines the subdirectories in the specified zip file /// Determines the oldest and newest modified analysis.baf files (or apexAcquisition.method file if analysis.baf files are not found) /// Presumes this is the AcqStartTime and AcqEndTime /// </summary> /// <param name="zipFile"></param> /// <param name="datasetFileInfo"></param> /// <returns>True if at least one valid file is found; otherwise false</returns> /// <remarks></remarks> private void DetermineAcqStartEndTime(FileInfo zipFile, DatasetFileInfo datasetFileInfo) { var success = false; try { // Bump up the file size datasetFileInfo.FileSizeBytes += zipFile.Length; var fileNamesToFind = new List <string> { "analysis.baf", "apexAcquisition.method", "submethods.xml" }; var zipFileReader = new Ionic.Zip.ZipFile(zipFile.FullName); foreach (var fileNameToFind in fileNamesToFind) { using (var zipEntry = zipFileReader.GetEnumerator()) { while (zipEntry.MoveNext()) { if (zipEntry.Current == null) { continue; } if (zipEntry.Current.IsDirectory) { continue; } // Split the filename on the forward slash character var nameParts = zipEntry.Current.FileName.Split('/'); if (nameParts.Length <= 0) { continue; } if (!string.Equals(nameParts[nameParts.Length - 1], fileNameToFind, StringComparison.OrdinalIgnoreCase)) { continue; } if (zipEntry.Current.LastModified < datasetFileInfo.AcqTimeStart) { datasetFileInfo.AcqTimeStart = zipEntry.Current.LastModified; } if (zipEntry.Current.LastModified > datasetFileInfo.AcqTimeEnd) { datasetFileInfo.AcqTimeEnd = zipEntry.Current.LastModified; } // Bump up the scan count datasetFileInfo.ScanCount += 1; // Add a Scan Stats entry var scanStatsEntry = new ScanStatsEntry { ScanNumber = datasetFileInfo.ScanCount, ScanType = 1, ScanTypeName = "MALDI-HMS", ScanFilterText = string.Empty, ElutionTime = "0", TotalIonIntensity = "0", BasePeakIntensity = "0", BasePeakMZ = "0", BasePeakSignalToNoiseRatio = "0", IonCount = 0, IonCountRaw = 0 }; // Base peak signal to noise ratio mDatasetStatsSummarizer.AddDatasetScan(scanStatsEntry); success = true; } } if (success) { break; } } } catch (Exception ex) { OnErrorEvent("Error in DetermineAcqStartEndTime: " + ex.Message); } }