public AutoQCBackgroundWorker(IAppControl appControl, IProcessControl processControl, IAutoQCLogger logger)
        {
            _appControl = appControl;
            _processControl = processControl;
            _logger = logger;

            _fileWatcher = new AutoQCFileSystemWatcher(logger);
        }
        public AutoQCBackgroundWorker(IAppControl appControl, IProcessControl processControl, IAutoQCLogger logger)
        {
            _appControl     = appControl;
            _processControl = processControl;
            _logger         = logger;

            _fileWatcher = new AutoQCFileSystemWatcher(logger);
        }
        public AutoQCFileSystemWatcher(IAutoQCLogger logger)
        {
            _fileWatcher = InitFileSystemWatcher();

            _logger = logger;

            _networkDrive = new NetworkDriveUtil(this, logger);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public bool IsIntegrateAllChecked(IAutoQCLogger logger)
        {
            try
            {
                using (var stream = new FileStream(SkylineFilePath, FileMode.Open))
                {
                    using (XmlReader reader = XmlReader.Create(stream))
                    {
                        reader.MoveToContent();

                        var done = false;
                        while (reader.Read() && !done)
                        {
                            switch (reader.NodeType)
                            {
                            case XmlNodeType.Element:

                                if (reader.Name == "transition_integration")
                                {
                                    if (reader.MoveToAttribute("integrate_all"))
                                    {
                                        bool integrateAll;
                                        Boolean.TryParse(reader.Value, out integrateAll);
                                        return(integrateAll);
                                    }
                                    done = true;
                                }
                                break;

                            case XmlNodeType.EndElement:
                                if (reader.Name.Equals("transition_settings"))     // We have come too far
                                {
                                    done = true;
                                }
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                logger.LogError("Exception reading file {0}. Exception details are: ", SkylineFilePath);
                logger.LogException(e);
                return(false);
            }
            logger.LogError("Skyline documents with QC results should have the\"Integrate all\" setting, under the \"Settings\" menu, checked. Please save the Skyline document with \"Integrate all\" checked and restart AutoQC.");
            return(false);
        }
Beispiel #6
0
        private static DateTime GetLastAcquiredFileDate(string reportFile, IAutoQCLogger logger)
        {
            var lastAcq = new DateTime();

            using (var reader = new StreamReader(reportFile))
            {
                string line; // Read the column headers
                var    first = true;

                while ((line = reader.ReadLine()) != null)
                {
                    if (first)
                    {
                        first = false;
                        continue;
                    }

                    var values = line.Split(',');
                    if (values.Length == 3)
                    {
                        DateTime acqDate = new DateTime();
                        try
                        {
                            acqDate = DateTime.Parse(values[2]);
                        }
                        catch (Exception e)
                        {
                            logger.LogError("Error parsing acquired time from Skyline report: {0}", reportFile);
                            logger.LogException(e);
                        }
                        if (acqDate.CompareTo(lastAcq) == 1)
                        {
                            lastAcq = acqDate;
                        }
                    }
                }
            }

            return(lastAcq);
        }
Beispiel #7
0
 public ProcessRunner(IAutoQCLogger logger)
 {
     _logger = logger;
 }
Beispiel #8
0
 public SprocopSettingsTab(IAppControl appControl, IAutoQCLogger logger)
     : base(appControl, logger)
 {
 }
Beispiel #9
0
 public PanoramaSettingsTab(IAppControl appControl, IAutoQCLogger logger)
     : base(appControl, logger)
 {
     Settings = new PanoramaSettings();
 }
Beispiel #10
0
 public PanoramaPinger(PanoramaSettingsTab panoramaSettingsTab, IAutoQCLogger logger)
 {
     _panoramaSettingsTab = panoramaSettingsTab;
     _logger = logger;
 }
        public AutoQCFileSystemWatcher(IAutoQCLogger logger)
        {
            _fileWatcher = InitFileSystemWatcher();

            _logger = logger;
        }
Beispiel #12
0
 protected SettingsTab(IAppControl appControl, IAutoQCLogger logger)
 {
     _appControl = appControl;
     Logger = logger;
 }
Beispiel #13
0
 protected SettingsTab(IAppControl appControl, IAutoQCLogger logger)
 {
     _appControl = appControl;
     Logger      = logger;
 }
 public TestProcessControl(IAutoQCLogger logger)
 {
     _logger = logger;
 }
 public MockProcessRunner(IAutoQCLogger logger) : base(logger)
 {
 }
Beispiel #16
0
 public MainSettingsTab(IAppControl appControl, IAutoQCLogger logger)
     : base(appControl, logger)
 {
     Settings = new MainSettings();
 }
Beispiel #17
0
 public SprocopSettingsTab(IAppControl appControl, IAutoQCLogger logger)
     : base(appControl, logger)
 {
 }
Beispiel #18
0
 public PanoramaSettingsTab(IAppControl appControl, IAutoQCLogger logger)
     : base(appControl, logger)
 {
     Settings = new PanoramaSettings();
 }
        public AutoQCFileSystemWatcher(IAutoQCLogger logger)
        {
            _fileWatcher = InitFileSystemWatcher();

            _logger = logger;
        }
Beispiel #20
0
 public NetworkDriveUtil(AutoQCFileSystemWatcher fileSystemWatcher, IAutoQCLogger logger)
 {
     _fileSystemWatcher = fileSystemWatcher;
     _logger            = logger;
 }
Beispiel #21
0
 public MainSettingsTab(IAppControl appControl, IAutoQCLogger logger)
     : base(appControl, logger)
 {
     Settings = new MainSettings();
 }
Beispiel #22
0
        public bool IsIntegrateAllChecked(IAutoQCLogger logger)
        {
            try
            {
                using (var stream = new FileStream(SkylineFilePath, FileMode.Open))
                {
                    using (XmlReader reader = XmlReader.Create(stream))
                    {
                        reader.MoveToContent();

                        var done = false;
                        while (reader.Read() && !done)
                        {
                            switch (reader.NodeType)
                            {
                                case XmlNodeType.Element:

                                    if (reader.Name == "transition_integration")
                                    {
                                        if (reader.MoveToAttribute("integrate_all"))
                                        {
                                            bool integrateAll;
                                            Boolean.TryParse(reader.Value, out integrateAll);
                                            return integrateAll;
                                        }
                                        done = true;
                                    }
                                    break;
                                case XmlNodeType.EndElement:
                                    if (reader.Name.Equals("transition_settings")) // We have come too far
                                    {
                                        done = true;
                                    }
                                    break;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                logger.LogError("Exception reading file {0}. Exception details are: ", SkylineFilePath);
                logger.LogException(e);
                return false;
            }
            logger.LogError("Skyline documents with QC results should have the\"Integrate all\" setting, under the \"Settings\" menu, checked. Please save the Skyline document with \"Integrate all\" checked and restart AutoQC.");
            return false;
        }
Beispiel #23
0
 public ProcessRunner(IAutoQCLogger logger)
 {
     _logger = logger;
 }
 public TestProcessControl(IAutoQCLogger logger)
 {
     _logger = logger;
 }
Beispiel #25
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;
        }
Beispiel #26
0
        private static DateTime GetLastAcquiredFileDate(string reportFile, IAutoQCLogger logger)
        {
            var lastAcq = new DateTime();

            using (var reader = new StreamReader(reportFile))
            {
                string line; // Read the column headers
                var first = true;

                while ((line = reader.ReadLine()) != null)
                {
                    if (first)
                    {
                        first = false;
                        continue;
                    }

                    var values = line.Split(',');
                    if (values.Length == 3)
                    {
                        DateTime acqDate = new DateTime();
                        try
                        {
                            acqDate = DateTime.Parse(values[2]);
                        }
                        catch (Exception e)
                        {
                            logger.LogError("Error parsing acquired time from Skyline report: {0}", reportFile);
                            logger.LogException(e);
                        }
                        if (acqDate.CompareTo(lastAcq) == 1)
                        {
                            lastAcq = acqDate;
                        }
                    }
                }
            }

            return lastAcq;
        }
 public MockProcessRunner(IAutoQCLogger logger)
     : base(logger)
 {
 }