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

KSP-CKAN / CKAN / 15833572481

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

push

github

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

3882 of 9479 branches covered (40.95%)

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%)

0.88 hits per line

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

1.61
/GUI/Main/MainExport.cs
1
using System;
2
using System.IO;
3
using System.Collections.Generic;
4
using System.Linq;
5
using System.Threading.Tasks;
6
using System.Windows.Forms;
7

8
using CKAN.Exporters;
9
using CKAN.Types;
10

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

14
namespace CKAN.GUI
15
{
16
    public partial class Main
17
    {
18
        /// <summary>
19
        /// Exports installed mods to a .ckan file.
20
        /// </summary>
21
        private void ExportModPackToolStripMenuItem_Click(object? sender, EventArgs? e)
22
        {
×
23
            if (CurrentInstance != null)
×
24
            {
×
25
                // Background thread so GUI thread can work with the controls
NEW
26
                Task.Run(() =>
×
27
                {
×
28
                    currentUser.RaiseMessage("");
×
29
                    tabController.ShowTab(EditModpackTabPage.Name, 2);
×
30
                    DisableMainWindow();
×
31
                    var mgr = RegistryManager.Instance(CurrentInstance, repoData);
×
32
                    EditModpack.LoadModule(mgr.GenerateModpack(false, true), mgr.registry);
×
33
                    // This will block till the user is done
34
                    EditModpack.Wait(currentUser);
×
35
                    EnableMainWindow();
×
36
                    tabController.ShowTab(ManageModsTabPage.Name);
×
37
                    tabController.HideTab(EditModpackTabPage.Name);
×
38
                });
×
39
            }
×
40
        }
×
41

42
        private void EditModpack_OnSelectedItemsChanged(ListView.SelectedListViewItemCollection items)
43
        {
×
44
            if (items.OfType<ListViewItem>()
×
45
                             .FirstOrDefault()
46
                             ?.Tag
47
                     is ModuleRelationshipDescriptor first)
48
            {
×
49
                var ident = first.name;
×
50
                if (!string.IsNullOrEmpty(ident)
×
51
                    && ManageMods.mainModList.full_list_of_mod_rows.TryGetValue(ident, out DataGridViewRow? row))
52
                {
×
53
                    ActiveModInfo = row.Tag as GUIMod;
×
54
                }
×
55
                else
56
                {
×
57
                    ActiveModInfo = null;
×
58
                }
×
59
            }
×
60
        }
×
61

62
        private static readonly List<ExportOption> specialExportOptions = new List<ExportOption>
2✔
63
        {
64
            new ExportOption(ExportFileType.PlainText, Properties.Resources.MainPlainText, "txt"),
65
            new ExportOption(ExportFileType.Markdown,  Properties.Resources.MainMarkdown,  "md"),
66
            new ExportOption(ExportFileType.BbCode,    Properties.Resources.MainBBCode,    "txt"),
67
            new ExportOption(ExportFileType.Csv,       Properties.Resources.MainCSV,       "csv"),
68
            new ExportOption(ExportFileType.Tsv,       Properties.Resources.MainTSV,       "tsv"),
69
        };
70

71
        /// <summary>
72
        /// Exports installed mods to a non-.ckan file.
73
        /// </summary>
74
        private void ExportModListToolStripMenuItem_Click(object? sender, EventArgs? e)
75
        {
×
76
            if (CurrentInstance != null)
×
77
            {
×
78
                var dlg = new SaveFileDialog()
×
79
                {
80
                    Filter = string.Join("|", specialExportOptions.Select(i => i.ToString()).ToArray()),
×
81
                    Title  = Properties.Resources.ExportInstalledModsDialogTitle
82
                };
83
                if (dlg.ShowDialog(this) == DialogResult.OK)
×
84
                {
×
85
                    var fileMode = File.Exists(dlg.FileName) ? FileMode.Truncate : FileMode.CreateNew;
×
86
                    using (var stream = new FileStream(dlg.FileName, fileMode))
×
87
                    {
×
88
                        var regMgr = RegistryManager.Instance(CurrentInstance, repoData);
×
89
                        new Exporter(specialExportOptions[dlg.FilterIndex - 1].ExportFileType).Export(regMgr, regMgr.registry, stream);
×
90
                    }
×
91
                }
×
92
            }
×
93
        }
×
94

95
    }
96
}
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