コード例 #1
0
ファイル: MainSettings.cs プロジェクト: zrolfs/pwiz
        public DateTime GetLastArchivalDate(IFileSystemUtil fileUtil)
        {
            if (!LastArchivalDate.Equals(DateTime.MinValue))
            {
                return(LastArchivalDate);
            }

            if (!LastAcquiredFileDate.Equals(DateTime.MinValue))
            {
                LastArchivalDate = LastAcquiredFileDate;
                return(LastArchivalDate);
            }

            var fileName = Path.GetFileNameWithoutExtension(SkylineFilePath);
            var pattern  = fileName + "_\\d{4}_\\d{2}.sky.zip";
            var regex    = new Regex(pattern);

            var skylineFileDir = Path.GetDirectoryName(SkylineFilePath);

            // Look at any existing .sky.zip files to determine the last archival date
            // Look for shared zip files with file names like <skyline_file_name>_<yyyy>_<mm>.sky.zip
            var archiveFiles =
                fileUtil.GetSkyZipFiles(skylineFileDir)
                .Where(f => regex.IsMatch(Path.GetFileName(f) ?? string.Empty))
                .OrderBy(filePath => fileUtil.LastWriteTime(filePath))
                .ToList();

            LastArchivalDate = archiveFiles.Any() ? fileUtil.LastWriteTime(archiveFiles.Last()) : DateTime.Today;

            return(LastArchivalDate);
        }
コード例 #2
0
ファイル: MainSettings.cs プロジェクト: zrolfs/pwiz
 protected bool Equals(MainSettings other)
 {
     return(string.Equals(SkylineFilePath, other.SkylineFilePath) &&
            string.Equals(FolderToWatch, other.FolderToWatch) &&
            IncludeSubfolders == other.IncludeSubfolders &&
            Equals(QcFileFilter, other.QcFileFilter) &&
            ResultsWindow == other.ResultsWindow &&
            string.Equals(InstrumentType, other.InstrumentType) &&
            AcquisitionTime == other.AcquisitionTime &&
            LastAcquiredFileDate.Equals(other.LastAcquiredFileDate));
 }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: MainSettings.cs プロジェクト: zrolfs/pwiz
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (SkylineFilePath != null ? SkylineFilePath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FolderToWatch != null ? FolderToWatch.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IncludeSubfolders.GetHashCode();
         hashCode = (hashCode * 397) ^ (QcFileFilter != null ? QcFileFilter.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ResultsWindow;
         hashCode = (hashCode * 397) ^ (InstrumentType != null ? InstrumentType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ AcquisitionTime;
         hashCode = (hashCode * 397) ^ LastAcquiredFileDate.GetHashCode();
         return(hashCode);
     }
 }