private bool ProcessOneFile(ImportContext importContext) { var processInfos = _processControl.GetProcessInfos(importContext); if (processInfos.Any(procInfo => !_processControl.RunProcess(procInfo))) { return(false); } _totalImportCount++; return(true); }
public bool ReadLastAcquiredFileDate(IAutoQCLogger logger, IProcessControl processControl) { logger.Log("Getting the acquisition date on the newest file imported into the Skyline document.", 1, 0); var exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (exeDir == null) { logger.LogError("Cound not get path to the Skyline report file"); return(false); } var skyrFile = Path.Combine(exeDir, "FileAcquisitionTime.skyr"); var reportFile = Path.Combine(SkylineFileDir, "AcquisitionTimes.csv"); // Export a report from the given Skyline file var args = string.Format( @" --in=""{0}"" --report-conflict-resolution=overwrite --report-add=""{1}"" --report-name=""{2}"" --report-file=""{3}""", SkylineFilePath, skyrFile, "AcquisitionTimes", reportFile); var procInfo = new ProcessInfo(AutoQCForm.SkylineRunnerPath, AutoQCForm.SKYLINE_RUNNER, args, args); if (!processControl.RunProcess(procInfo)) { logger.LogError("Error getting the last acquired file date from the Skyline document."); return(false); } // Read the exported report to get the last AcquiredTime for imported results in the Skyline doucment. if (!File.Exists(reportFile)) { logger.LogError("Could not find report outout {0}", reportFile); return(false); } try { LastAcquiredFileDate = GetLastAcquiredFileDate(reportFile, logger); if (!LastAcquiredFileDate.Equals(DateTime.MinValue)) { logger.Log("The most recent acquisition date in the Skyline document is {0}", LastAcquiredFileDate); } else { logger.Log("The Skyline document does not have any imported results."); } } catch (IOException e) { logger.LogError("Exception reading file {0}. Exception details are: ", reportFile); logger.LogException(e); return(false); } return(true); }
public bool ReadLastAcquiredFileDate(IAutoQCLogger logger, IProcessControl processControl) { logger.Log("Getting the acquisition date on the newest file imported into the Skyline document.", 1, 0); var exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (exeDir == null) { logger.LogError("Cound not get path to the Skyline report file"); return false; } var skyrFile = Path.Combine(exeDir, "FileAcquisitionTime.skyr"); var reportFile = Path.Combine(SkylineFileDir, "AcquisitionTimes.csv"); // Export a report from the given Skyline file var args = string.Format( @" --in=""{0}"" --report-conflict-resolution=overwrite --report-add=""{1}"" --report-name=""{2}"" --report-file=""{3}""", SkylineFilePath, skyrFile, "AcquisitionTimes", reportFile); var procInfo = new ProcessInfo(AutoQCForm.SkylineRunnerPath, AutoQCForm.SKYLINE_RUNNER, args, args); if (!processControl.RunProcess(procInfo)) { logger.LogError("Error getting the last acquired file date from the Skyline document."); return false; } // Read the exported report to get the last AcquiredTime for imported results in the Skyline doucment. if (!File.Exists(reportFile)) { logger.LogError("Could not find report outout {0}", reportFile); return false; } try { LastAcquiredFileDate = GetLastAcquiredFileDate(reportFile, logger); if (!LastAcquiredFileDate.Equals(DateTime.MinValue)) { logger.Log("The most recent acquisition date in the Skyline document is {0}", LastAcquiredFileDate); } else { logger.Log("The Skyline document does not have any imported results."); } } catch (IOException e) { logger.LogError("Exception reading file {0}. Exception details are: ", reportFile); logger.LogException(e); return false; } return true; }