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

KSP-CKAN / CKAN / 15432034930

04 Jun 2025 02:19AM UTC coverage: 30.322% (+0.04%) from 30.28%
15432034930

Pull #4386

github

web-flow
Merge f8b59bcd0 into 4cf303cc8
Pull Request #4386: Mod list multi-select

4063 of 14340 branches covered (28.33%)

Branch coverage included in aggregate %.

55 of 170 new or added lines in 12 files covered. (32.35%)

59 existing lines in 5 files now uncovered.

13712 of 44281 relevant lines covered (30.97%)

0.63 hits per line

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

42.11
/Core/Configuration/Win32RegistryConfiguration.cs
1
#if NET5_0_OR_GREATER
2
using System.Runtime.Versioning;
3
#endif
4

5
namespace CKAN.Configuration
6
{
7
    using WinReg = Microsoft.Win32.Registry;
8

9
    /// <summary>
10
    /// Originally, CKAN's system level configuration was stored in the
11
    /// Windows registry (and Mono's emulation of it in ~/.mono/registry/).
12
    /// netstandard2.0 does not provide the Microsoft.Win32 namespace,
13
    /// so this was replaced by a config.json file in the app data folder.
14
    /// This class now exists solely to purge the old registry data.
15
    /// </summary>
16
    #if NET5_0_OR_GREATER
17
    [SupportedOSPlatform("windows")]
18
    #endif
19
    internal class Win32RegistryConfiguration
20
    {
21
        public static bool DoesRegistryConfigurationExist()
22
            => WinReg.CurrentUser.OpenSubKey(CKAN_KEY_NO_PREFIX) != null;
2✔
23

24
        public static void DeleteAllKeys()
UNCOV
25
        {
×
26
            try
27
            {
×
NEW
28
                WinReg.CurrentUser.DeleteSubKeyTree(CKAN_KEY_NO_PREFIX);
×
29
            }
×
30
            catch
×
31
            {
×
32
                // This can fail if the key doesn't exist, but we don't really care...
UNCOV
33
            }
×
34
        }
×
35

36
        private static string StripPrefixKey(string keyname)
37
            => keyname.IndexOf(@"\") switch
2!
38
               {
NEW
39
                   < 0                => keyname,
×
40
                   var firstBackslash => keyname[(1 + firstBackslash)..],
2!
41
               };
42

43
        private const  string CKAN_KEY           =  @"HKEY_CURRENT_USER\Software\CKAN";
44
        private static string CKAN_KEY_NO_PREFIX => StripPrefixKey(CKAN_KEY);
2✔
45
    }
46
}
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