コード例 #1
0
 private void ProcessFilesCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         LogError("An exception occurred while importing the file.");
         _logger.LogException(e.Error);
     }
     else if (e.Result == null)
     {
         Log("Error importing file.");
     }
     else if (CANCELLED.Equals(e.Result))
     {
         Log("Cancelled importing files.");
     }
     else
     {
         LogWithSpace("Finished importing files.");
     }
     Stop();
 }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
0
        public void PingPanoramaServer()
        {
            var panoramaServerUri = _panoramaSettingsTab.PanoramaServerUri;

            if (_panoramaSettingsTab.IsSelected() && panoramaServerUri != null)
            {
                var panoramaClient = new WebPanoramaClient(panoramaServerUri);
                try
                {
                    var success = panoramaClient.PingPanorama(_panoramaSettingsTab.Settings.PanoramaFolder,
                                                              _panoramaSettingsTab.Settings.PanoramaUserEmail,
                                                              _panoramaSettingsTab.DecryptPassword(_panoramaSettingsTab.Settings.PanoramaPassword
                                                                                                   ));

                    if (success && _status != 1)
                    {
                        _logger.Log("Successfully pinged Panorama server.");
                        _status = 1;
                    }
                    if (!success && _status != 2)
                    {
                        _logger.LogErrorToFile("Error pinging Panorama server.  Please confirm that " + panoramaServerUri +
                                               " is running LabKey Server 16.1 or higher.");
                        _status = 2;
                    }
                }
                catch (Exception ex)
                {
                    if (_status != 2)
                    {
                        _logger.LogError("Error pinging Panorama server " + panoramaServerUri);
                        _logger.LogException(ex);
                        _status = 2;
                    }
                }
            }
        }
コード例 #6
0
ファイル: MainSettings.cs プロジェクト: lgatto/proteowizard
        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;
        }
コード例 #7
0
ファイル: MainSettings.cs プロジェクト: lgatto/proteowizard
        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;
        }
コード例 #8
0
ファイル: MainSettings.cs プロジェクト: lgatto/proteowizard
        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;
        }
コード例 #9
0
ファイル: ProcessInfo.cs プロジェクト: suchp-max/proteowizard
 private void LogException(Exception e, string message, params Object[] args)
 {
     _logger.LogError(message, args);
     _logger.LogException(e);
 }