コード例 #1
0
        public UpdatePackage AvailableUpdate()
        {
            if (OsInfo.IsNotWindows && !_configFileProvider.UpdateAutomatically)
            {
                return(null);
            }

            var latestAvailable = _updatePackageProvider.GetLatestUpdate(_configFileProvider.Branch, BuildInfo.Version);

            if (latestAvailable == null)
            {
                _logger.ProgressDebug("No update available.");
            }
            else if (latestAvailable.Branch != _configFileProvider.Branch)
            {
                try
                {
                    _logger.Info("Branch [{0}] is being redirected to [{1}]]", _configFileProvider.Branch, latestAvailable.Branch);
                    var config = _configFileProvider.GetConfigDictionary();
                    config["Branch"] = latestAvailable.Branch;
                    _configFileProvider.SaveConfigDictionary(config);
                }
                catch (Exception e)
                {
                    _logger.ErrorException("Couldn't save the branch redirect.", e);
                }
            }

            return(latestAvailable);
        }
コード例 #2
0
ファイル: UpdateCheckService.cs プロジェクト: jayd2446/Sonarr
        public UpdatePackage AvailableUpdate()
        {
            if (OsInfo.IsMono && !_configFileProvider.UpdateAutomatically)
            {
                return(null);
            }

            var latestAvailable = _updatePackageProvider.GetLatestUpdate(_configFileProvider.Branch, BuildInfo.Version);

            if (latestAvailable == null)
            {
                _logger.ProgressDebug("No update available.");
            }
            else if (latestAvailable.Branch != _configFileProvider.Branch)
            {
                try
                {
                    _logger.Warn("[{0}] isn't a valid branch. Switching back to [master]", _configFileProvider.Branch);
                    var config = _configFileProvider.GetConfigDictionary();
                    config["Branch"] = _configFileProvider.Branch;
                    _configFileProvider.SaveConfigDictionary(config);
                }
                catch (Exception e)
                {
                    _logger.ErrorException("Couldn't revert back to master.", e);
                }
            }

            return(latestAvailable);
        }
コード例 #3
0
        public UpdatePackage AvailableUpdate()
        {
            if (OsInfo.IsMono && !_configFileProvider.UpdateAutomatically)
            {
                return(null);
            }

            var latestAvailable = _updatePackageProvider.GetLatestUpdate(_configFileProvider.Branch, BuildInfo.Version);

            if (latestAvailable == null)
            {
                _logger.ProgressDebug("No update available.");
            }

            return(latestAvailable);
        }
コード例 #4
0
 public UpdatePackage AvailableUpdate()
 {
     return(_updatePackageProvider.GetLatestUpdate(_configFileProvider.Branch, BuildInfo.Version));
 }