Skip to content

Commit 2aea1b1

Browse files
committed
Merge #4426 A few more tests
2 parents ca38b66 + b07d109 commit 2aea1b1

29 files changed

+431
-150
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ All notable changes to this project will be documented in this file.
2929
- [Netkan] Exclude internal .ckan files from `install_size` (#4348 by: HebaruSan)
3030
- [Core] Generate and tidy up XML docs for Core (#4351 by: HebaruSan)
3131
- [Core] Use setter instead of reflection to set max transaction timeout (#4365 by: doinkythederp; reviewed: HebaruSan)
32-
- [Build] Coverage and more tests (#4383, #4396, #4408, #4420, #4422, #4423, #4425 by: HebaruSan)
32+
- [Build] Coverage and more tests (#4383, #4396, #4408, #4420, #4422, #4423, #4425, #4426 by: HebaruSan)
3333
- [Multiple] Switch Inflator from Mono to dotnet (#4387 by: HebaruSan)
3434
- [Multiple] Migrate metadata tester from Mono to dotnet (#4390 by: HebaruSan)
3535
- [Multiple] Writethrough when saving files, add Netkan tests (#4392 by: HebaruSan)

Cmdline/Action/Update.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private void PrintModules(string message, IEnumerable<CkanModule> modules)
164164

165165
user.RaiseMessage("{0}", message);
166166

167-
foreach (CkanModule module in modules)
167+
foreach (CkanModule module in modules.OrderBy(m => m.name))
168168
{
169169
user.RaiseMessage("{0} ({1})", module.name, module.identifier);
170170
}

Cmdline/Main.cs

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ private static int RunSimpleAction(Options cmdline, CommonOptions options, strin
244244
return (new Available(repoData, user)).RunCommand(GetGameInstance(manager), cmdline.options);
245245

246246
case "install":
247-
Scan(GetGameInstance(manager), user, repoData, cmdline.action);
247+
Scan(GetGameInstance(manager), repoData);
248248
return (new Install(manager, repoData, user)).RunCommand(GetGameInstance(manager), cmdline.options);
249249

250250
case "scan":
251-
return Scan(GetGameInstance(manager), user, repoData);
251+
return Scan(GetGameInstance(manager), repoData);
252252

253253
case "list":
254254
return (new List(repoData, user, Console.OpenStandardOutput())).RunCommand(GetGameInstance(manager), cmdline.options);
@@ -257,11 +257,11 @@ private static int RunSimpleAction(Options cmdline, CommonOptions options, strin
257257
return (new Show(repoData, user)).RunCommand(GetGameInstance(manager), cmdline.options);
258258

259259
case "replace":
260-
Scan(GetGameInstance(manager), user, repoData, cmdline.action);
260+
Scan(GetGameInstance(manager), repoData);
261261
return (new Replace(manager, repoData, user)).RunCommand(GetGameInstance(manager), (ReplaceOptions)cmdline.options);
262262

263263
case "upgrade":
264-
Scan(GetGameInstance(manager), user, repoData, cmdline.action);
264+
Scan(GetGameInstance(manager), repoData);
265265
return (new Upgrade(manager, repoData, user)).RunCommand(GetGameInstance(manager), cmdline.options);
266266

267267
case "search":
@@ -348,30 +348,10 @@ private static int Version(IUser user)
348348
/// <param name="next_command">Changes the output message if set.</param>
349349
/// <returns>Exit.OK if instance is consistent, Exit.ERROR otherwise </returns>
350350
private static int Scan(CKAN.GameInstance inst,
351-
IUser user,
352-
RepositoryDataManager repoData,
353-
string? next_command = null)
351+
RepositoryDataManager repoData)
354352
{
355-
try
356-
{
357-
RegistryManager.Instance(inst, repoData).ScanUnmanagedFiles();
358-
return Exit.OK;
359-
}
360-
catch (InconsistentKraken kraken)
361-
{
362-
363-
if (next_command == null)
364-
{
365-
user.RaiseError("{0}", kraken.Message);
366-
user.RaiseError(Properties.Resources.ScanNotSaved);
367-
}
368-
else
369-
{
370-
user.RaiseMessage(Properties.Resources.ScanPreliminaryInconsistent, next_command);
371-
}
372-
373-
return Exit.ERROR;
374-
}
353+
RegistryManager.Instance(inst, repoData).ScanUnmanagedFiles();
354+
return Exit.OK;
375355
}
376356

377357
private static int Clean(NetModuleCache? cache)

Cmdline/Properties/Resources.fr-FR.resx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -728,14 +728,6 @@ Appuyez sur tabulation pour compléter les commandes et les modules.
728728
<data name="UpgradeAllUpToDate" xml:space="preserve">
729729
<value>Tous les modules sont à jour</value>
730730
</data>
731-
<data name="ScanNotSaved" xml:space="preserve">
732-
<value>Le répertoire n'a pas été sauvegardé</value>
733-
</data>
734-
<data name="ScanPreliminaryInconsistent" xml:space="preserve">
735-
<value>L'analyse préliminaire montre que l'installation est dans un état incohérent.
736-
Utilisez ckan.exe scan pour plus de détails
737-
Exécution de {0} au cas où cela réglerait le problème.</value>
738-
</data>
739731
<data name="FilterListGlobalHeader" xml:space="preserve">
740732
<value>Filtres globaux pour {0} :</value>
741733
</data>

Cmdline/Properties/Resources.it-IT.resx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -677,14 +677,6 @@ Premi tab per il completamento automatico dei comandi e dei moduli.
677677
<data name="UpgradeAborted" xml:space="preserve">
678678
<value>Aggiornamento interrotto: {0}</value>
679679
</data>
680-
<data name="ScanNotSaved" xml:space="preserve">
681-
<value>La repo non è stata salvata</value>
682-
</data>
683-
<data name="ScanPreliminaryInconsistent" xml:space="preserve">
684-
<value>La scansione preliminare mostra che l'installazione è in uno stato incoerente.
685-
Usa la scansione ckan.exe per maggiori dettagli.
686-
Procedere con {0} nel caso in cui si risolva il problema.</value>
687-
</data>
688680
<data name="FilterListGlobalHeader" xml:space="preserve">
689681
<value>Filtri Globali:</value>
690682
</data>

Cmdline/Properties/Resources.pl-PL.resx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,6 @@ Naciśnij tab, aby automatycznie uzupełniać polecenia i moduły.
647647
<data name="UpgradeAborted" xml:space="preserve">
648648
<value>Aktualizacja przerwana: {0}</value>
649649
</data>
650-
<data name="ScanNotSaved" xml:space="preserve">
651-
<value>Repozytorium nie zostało zapisane</value>
652-
</data>
653-
<data name="ScanPreliminaryInconsistent" xml:space="preserve">
654-
<value>Wstępne skanowanie pokazuje, że instalacja jest w niespójnym stanie.
655-
Użyj skanu ckan.exe w celu uzyskania więcej szczegółów
656-
Kontynuuj z {0} na wypadek gdyby problem się naprawił.</value>
657-
</data>
658650
<data name="FilterListGlobalHeader" xml:space="preserve">
659651
<value>Filtry globalne:</value>
660652
</data>

Cmdline/Properties/Resources.resx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,6 @@ Press tab to auto-complete commands and modules.
337337
<data name="UpgradeFailed" xml:space="preserve"><value>Upgrade failed: {0}"</value></data>
338338
<data name="UpgradeAlreadyUpToDate" xml:space="preserve"><value>Module {0} is already up to date</value></data>
339339
<data name="UpgradeAllUpToDate" xml:space="preserve"><value>All modules are up to date</value></data>
340-
<data name="ScanNotSaved" xml:space="preserve"><value>The repo has not been saved</value></data>
341-
<data name="ScanPreliminaryInconsistent" xml:space="preserve"><value>Preliminary scanning shows that the install is in a inconsistent state.
342-
Use ckan.exe scan for more details
343-
Proceeding with {0} in case it fixes it.</value></data>
344340
<data name="FilterListGlobalHeader" xml:space="preserve"><value>Global filters for {0}:</value></data>
345341
<data name="FilterListInstanceHeader" xml:space="preserve"><value>Instance filters for {0}:</value></data>
346342
<data name="FilterAddGlobalDuplicateError" xml:space="preserve"><value>Global filters already set: {0}</value></data>

Cmdline/Properties/Resources.ru-RU.resx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,4 @@
302302
<data name="UpgradePleaseWait" xml:space="preserve"><value>Обновление CKAN, пожалуйста, подождите...</value></data>
303303
<data name="UpgradeAlreadyHaveLatest" xml:space="preserve"><value>Ваша версия уже является последней</value></data>
304304
<data name="UpgradeAborted" xml:space="preserve"><value>Обновление отменено: {0}</value></data>
305-
<data name="ScanNotSaved" xml:space="preserve"><value>Репозиторий не сохранён</value></data>
306-
<data name="ScanPreliminaryInconsistent" xml:space="preserve"><value>Предварительное сканирование показывает, что сборка находится в несогласованном состоянии.
307-
Используйте ckan.exe для сканирования.
308-
Продолжение использования {0}.</value></data>
309305
</root>

Core/ServiceLocator.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,11 @@ namespace CKAN
1111
/// </summary>
1212
public static class ServiceLocator
1313
{
14-
private static IContainer? _container;
1514
public static IContainer Container
16-
{
1715
// NB: Totally not thread-safe.
18-
get
19-
{
20-
_container ??= Init();
21-
return _container;
22-
}
23-
24-
#pragma warning disable IDE0027
25-
set
26-
{
27-
_container = value;
28-
}
29-
#pragma warning restore IDE0027
30-
}
16+
=> _container ??= Init();
17+
18+
private static IContainer? _container;
3119

3220
private static IContainer Init()
3321
{

GUI/ControlFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using System.Diagnostics;
22
using System.Threading;
3+
using System.Diagnostics.CodeAnalysis;
34

45
namespace CKAN.GUI
56
{
67
/// <summary>
78
/// This class ensures that all controls are created from the same thread.
89
/// This is a mono limitation described here - http://www.mono-project.com/docs/faq/winforms/
910
/// </summary>
11+
[ExcludeFromCodeCoverage]
1012
public class ControlFactory
1113
{
1214
private readonly int m_MainThreadID;

0 commit comments

Comments
 (0)