• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

KSP-CKAN / CKAN / 15833572503

23 Jun 2025 07:42PM UTC coverage: 42.236% (+0.1%) from 42.099%
15833572503

push

github

HebaruSan
Merge #4398 Exception handling revamp, parallel multi-host inflation

3881 of 9479 branches covered (40.94%)

Branch coverage included in aggregate %.

48 of 137 new or added lines in 30 files covered. (35.04%)

12 existing lines in 6 files now uncovered.

8334 of 19442 relevant lines covered (42.87%)

3.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/GUI/Main/MainAutoUpdate.cs
1
using System;
2
using System.ComponentModel;
3
using System.Windows.Forms;
4

5
using Autofac;
6

7
using CKAN.Configuration;
8
using CKAN.Versioning;
9

10
// Don't warn if we use our own obsolete properties
11
#pragma warning disable 0618
12

13
namespace CKAN.GUI
14
{
15
    public partial class Main
16
    {
17
        private void AutoUpdatePrompts(IConfiguration   coreConfig,
18
                                       GUIConfiguration guiConfig)
19
        {
×
20
            if (!guiConfig.CheckForUpdatesOnLaunchNoNag && AutoUpdate.CanUpdate)
×
21
            {
×
22
                log.Debug("Asking user if they wish for auto-updates");
×
23
                if (new AskUserForAutoUpdatesDialog().ShowDialog(this) == DialogResult.OK)
×
24
                {
×
25
                    guiConfig.CheckForUpdatesOnLaunch = true;
×
26
                }
×
27
                guiConfig.CheckForUpdatesOnLaunchNoNag = true;
×
28
            }
×
29

30
            if (!coreConfig.DevBuilds.HasValue && guiConfig.CheckForUpdatesOnLaunch)
×
31
            {
×
32
                coreConfig.DevBuilds = !YesNoDialog(Properties.Resources.MainReleasesOrDevBuildsPrompt,
×
33
                                                    Properties.Resources.MainReleasesOrDevBuildsYes,
34
                                                    Properties.Resources.MainReleasesOrDevBuildsNo);
35
            }
×
36
        }
×
37

38
        /// <summary>
39
        /// Look for a CKAN update and start installing it if found.
40
        /// Note that this will happen on a background thread!
41
        /// </summary>
42
        /// <returns>
43
        /// true if update found, false otherwise.
44
        /// </returns>
45
        public bool CheckForCKANUpdate()
46
        {
×
47
            if (AutoUpdate.CanUpdate)
×
48
            {
×
49
                try
50
                {
×
51
                    log.Info("Making auto-update call");
×
52
                    var mainConfig = ServiceLocator.Container.Resolve<IConfiguration>();
×
NEW
53
                    var update = updater.GetUpdate(mainConfig.DevBuilds ?? false,
×
54
                                                   userAgent);
55

56
                    if (update.Version is CkanModuleVersion latestVersion
×
57
                        && !latestVersion.SameClientVersion(Meta.ReleaseVersion))
58
                    {
×
59
                        log.DebugFormat("Found higher CKAN version: {0}", latestVersion);
×
60
                        var releaseNotes = update.ReleaseNotes;
×
61
                        var dialog = new NewUpdateDialog(latestVersion.ToString(), releaseNotes);
×
62
                        if (dialog.ShowDialog(this) == DialogResult.OK)
×
63
                        {
×
64
                            return true;
×
65
                        }
66
                    }
×
67
                }
×
68
                catch (Exception exception)
×
69
                {
×
70
                    currentUser.RaiseError(Properties.Resources.MainAutoUpdateFailed,
×
71
                                           exception.Message);
72
                    log.Error("Error in auto-update", exception);
×
73
                }
×
74
            }
×
75
            return false;
×
76
        }
×
77

78
        /// <summary>
79
        /// Download a CKAN update and start AutoUpdater.exe, then exit.
80
        /// Note it will return control and then interrupt whatever is happening to exit!
81
        /// </summary>
82
        public void UpdateCKAN()
83
        {
×
84
            ShowWaitDialog();
×
85
            DisableMainWindow();
×
86
            tabController.RenameTab(WaitTabPage.Name, Properties.Resources.MainUpgradingWaitTitle);
×
87
            var mainConfig = ServiceLocator.Container.Resolve<IConfiguration>();
×
88
            var update = updater.GetUpdate(mainConfig.DevBuilds ?? false, userAgent);
×
89
            Wait.SetDescription(string.Format(Properties.Resources.MainUpgradingTo,
×
90
                                              update.Version));
91

92
            log.Info("Starting CKAN update");
×
93
            Wait.StartWaiting((sender, args) => updater.StartUpdateProcess(true, userAgent,
×
94
                                                                           mainConfig.DevBuilds ?? false, currentUser),
95
                              UpdateReady,
96
                              false,
97
                              null);
98
        }
×
99

100
        private void UpdateReady(object? sender, RunWorkerCompletedEventArgs? e)
101
        {
×
102
            // Close will be cancelled if the window is still disabled
103
            EnableMainWindow();
×
104
            Close();
×
105
        }
×
106

107
    }
108
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc