From 453a90720625e5c0b49b10614f783fb295a8f9a1 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Wed, 12 Apr 2023 19:32:08 -0500 Subject: [PATCH] Treat reinstalling a changed module as an update --- Cmdline/Action/List.cs | 6 +- Cmdline/Action/Update.cs | 4 - Cmdline/Action/Upgrade.cs | 2 +- ConsoleUI/ModListScreen.cs | 6 -- Core/Net/Repo.cs | 141 -------------------------- Core/Properties/Resources.Designer.cs | 6 -- Core/Properties/Resources.fr-FR.resx | 11 -- Core/Properties/Resources.it-IT.resx | 11 -- Core/Properties/Resources.pl-PL.resx | 11 -- Core/Properties/Resources.resx | 7 -- Core/Properties/Resources.ru-RU.resx | 7 -- Core/Properties/Resources.zh-CN.resx | 7 -- Core/Registry/IRegistryQuerier.cs | 43 +++++--- Core/Types/CkanModule.cs | 73 +++++++++++++ Core/Types/Kraken.cs | 12 --- GUI/Controls/ManageMods.cs | 7 +- GUI/Main/MainRepo.cs | 14 --- GUI/Model/GUIMod.cs | 3 +- GUI/Model/ModChange.cs | 31 ++---- GUI/Properties/Resources.Designer.cs | 3 + GUI/Properties/Resources.de-DE.resx | 1 + GUI/Properties/Resources.fr-FR.resx | 3 + GUI/Properties/Resources.it-IT.resx | 3 + GUI/Properties/Resources.ja-JP.resx | 1 + GUI/Properties/Resources.ko-KR.resx | 1 + GUI/Properties/Resources.pl-PL.resx | 3 + GUI/Properties/Resources.resx | 1 + GUI/Properties/Resources.ru-RU.resx | 1 + GUI/Properties/Resources.zh-CN.resx | 1 + 29 files changed, 140 insertions(+), 280 deletions(-) diff --git a/Cmdline/Action/List.cs b/Cmdline/Action/List.cs index 9f28713902..7bf9deaaa6 100644 --- a/Cmdline/Action/List.cs +++ b/Cmdline/Action/List.cs @@ -86,7 +86,7 @@ public int RunCommand(CKAN.GameInstance instance, object raw_options) { log.DebugFormat(" {0} installed version not found in registry", mod.Key); } - + // Check if mod is replaceable if (current.replaced_by != null) { @@ -99,7 +99,7 @@ public int RunCommand(CKAN.GameInstance instance, object raw_options) } } } - else if (latest.version.IsEqualTo(current_version)) + else if (latest.version.IsEqualTo(current_version) && !registry.HasUpdate(mod.Key, instance.VersionCriteria())) { // Up to date log.InfoFormat("Latest {0} is {1}", mod.Key, latest.version); @@ -116,7 +116,7 @@ public int RunCommand(CKAN.GameInstance instance, object raw_options) } } } - else if (latest.version.IsGreaterThan(mod.Value)) + else if (latest.version.IsGreaterThan(mod.Value) || registry.HasUpdate(mod.Key, instance.VersionCriteria())) { // Upgradable bullet = "^"; diff --git a/Cmdline/Action/Update.cs b/Cmdline/Action/Update.cs index 41b8f91522..408933a4c1 100644 --- a/Cmdline/Action/Update.cs +++ b/Cmdline/Action/Update.cs @@ -44,10 +44,6 @@ public int RunCommand(CKAN.GameInstance instance, object raw_options) { UpdateRepository(instance); } - catch (ReinstallModuleKraken rmk) - { - Upgrade.UpgradeModules(manager, user, instance, false, rmk.Modules); - } catch (MissingCertificateKraken kraken) { // Handling the kraken means we have prettier output. diff --git a/Cmdline/Action/Upgrade.cs b/Cmdline/Action/Upgrade.cs index 246d4b90f7..9cfaf50750 100644 --- a/Cmdline/Action/Upgrade.cs +++ b/Cmdline/Action/Upgrade.cs @@ -107,7 +107,7 @@ public int RunCommand(CKAN.GameInstance instance, object raw_options) continue; } - if (latest.version.IsGreaterThan(mod.Value)) + if (latest.version.IsGreaterThan(mod.Value) || registry.HasUpdate(mod.Key, instance.VersionCriteria())) { // Upgradable log.InfoFormat("New version {0} found for {1}", diff --git a/ConsoleUI/ModListScreen.cs b/ConsoleUI/ModListScreen.cs index 29197dc3ae..de73c1e96a 100644 --- a/ConsoleUI/ModListScreen.cs +++ b/ConsoleUI/ModListScreen.cs @@ -446,12 +446,6 @@ private bool UpdateRegistry(ConsoleTheme theme, bool showNewModsPrompt = true) manager.Cache, ps ); - } catch (ReinstallModuleKraken rmk) { - ChangePlan reinstPlan = new ChangePlan(); - foreach (CkanModule m in rmk.Modules) { - reinstPlan.ToggleUpgrade(m); - } - LaunchSubScreen(theme, new InstallScreen(manager, reinstPlan, debug)); } catch (Exception ex) { // There can be errors while you re-install mods with changed metadata ps.RaiseError(ex.Message + ex.StackTrace); diff --git a/Core/Net/Repo.cs b/Core/Net/Repo.cs index 301ad0e559..ee90fdf7d8 100644 --- a/Core/Net/Repo.cs +++ b/Core/Net/Repo.cs @@ -95,13 +95,7 @@ public static RepoUpdateResult UpdateAllRepositories(RegistryManager registry_ma registry_manager.registry.SetAllAvailable(modules); registry_manager.registry.SetDownloadCounts(dlCounts); registry_manager.Save(enforce_consistency: false); - ShowUserInconsistencies(registry_manager.registry, user); - List metadataChanges = GetChangedInstalledModules(registry_manager.registry); - if (metadataChanges.Count > 0 && cache != null) - { - HandleModuleChanges(metadataChanges, user, ksp, cache, registry_manager); - } } // Report success @@ -263,141 +257,6 @@ private static List ModulesFromZip(Repository repo, string path, IUs return modules; } - /// - /// Find installed modules that have different metadata in their equivalent available module - /// - /// Registry to scan - /// - /// List of CkanModules that are available and have changed metadata - /// - private static List GetChangedInstalledModules(Registry registry) - { - List metadataChanges = new List(); - foreach (InstalledModule installedModule in registry.InstalledModules) - { - string identifier = installedModule.identifier; - - ModuleVersion installedVersion = registry.InstalledVersion(identifier); - if (!(registry.available_modules.ContainsKey(identifier))) - { - log.InfoFormat("UpdateRegistry, module {0}, version {1} not in registry", identifier, installedVersion); - continue; - } - - if (!registry.available_modules[identifier].module_version.ContainsKey(installedVersion)) - { - continue; - } - - // if the mod is installed and the metadata is different we have to reinstall it - CkanModule metadata = registry.available_modules[identifier].module_version[installedVersion]; - - CkanModule oldMetadata = registry.InstalledModule(identifier).Module; - - if (!MetadataEquals(metadata, oldMetadata)) - { - metadataChanges.Add(registry.available_modules[identifier].module_version[installedVersion]); - } - } - return metadataChanges; - } - - /// - /// Resolve differences between installed and available metadata for given ModuleInstaller - /// - /// List of modules that changed - /// Object for user interaction callbacks - /// Game instance - /// Cacne object for mod downloads - /// Manager that holds our game instances - private static void HandleModuleChanges(List metadataChanges, IUser user, GameInstance ksp, NetModuleCache cache, RegistryManager registry_manager) - { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < metadataChanges.Count; i++) - { - CkanModule module = metadataChanges[i]; - sb.AppendLine(string.Format("- {0} {1}", module.identifier, module.version)); - } - - if (user.RaiseYesNoDialog(string.Format(Properties.Resources.NetRepoChangedModulesReinstallPrompt, sb))) - { - throw new ReinstallModuleKraken(metadataChanges); - } - } - - private static bool MetadataEquals(CkanModule metadata, CkanModule oldMetadata) - { - if ((metadata.install == null) != (oldMetadata.install == null) - || (metadata.install != null - && metadata.install.Length != oldMetadata.install.Length)) - { - return false; - } - else if (metadata.install != null) - { - for (int i = 0; i < metadata.install.Length; i++) - { - if (!metadata.install[i].Equals(oldMetadata.install[i])) - return false; - } - } - if (metadata.install_size != oldMetadata.install_size) - { - return false; - } - - if (!RelationshipsAreEquivalent(metadata.conflicts, oldMetadata.conflicts)) - return false; - - if (!RelationshipsAreEquivalent(metadata.depends, oldMetadata.depends)) - return false; - - if (!RelationshipsAreEquivalent(metadata.recommends, oldMetadata.recommends)) - return false; - - if (metadata.provides != oldMetadata.provides) - { - if (metadata.provides == null || oldMetadata.provides == null) - return false; - else if (!metadata.provides.OrderBy(i => i).SequenceEqual(oldMetadata.provides.OrderBy(i => i))) - return false; - } - return true; - } - - private static bool RelationshipsAreEquivalent(List a, List b) - { - if (a == b) - // If they're the same exact object they must be equivalent - return true; - - if (a == null || b == null) - // If they're not the same exact object and either is null then must not be equivalent - return false; - - if (a.Count != b.Count) - // If their counts different they must not be equivalent - return false; - - // Sort the lists so we can compare each relationship - var aSorted = a.OrderBy(i => i.ToString()).ToList(); - var bSorted = b.OrderBy(i => i.ToString()).ToList(); - - for (var i = 0; i < a.Count; i++) - { - var aRel = aSorted[i]; - var bRel = bSorted[i]; - - if (!aRel.Equals(bRel)) - { - return false; - } - } - - // If we couldn't find any differences they must be equivalent - return true; - } - private static CkanModule ProcessRegistryMetadataFromJSON(string metadata, string filename) { try diff --git a/Core/Properties/Resources.Designer.cs b/Core/Properties/Resources.Designer.cs index 1b770c2dc5..b1d7212b4c 100644 --- a/Core/Properties/Resources.Designer.cs +++ b/Core/Properties/Resources.Designer.cs @@ -150,9 +150,6 @@ internal static string NetRepoNoModules { internal static string NetRepoFailedDownload { get { return (string)(ResourceManager.GetObject("NetRepoFailedDownload", resourceCulture)); } } - internal static string NetRepoChangedModulesReinstallPrompt { - get { return (string)(ResourceManager.GetObject("NetRepoChangedModulesReinstallPrompt", resourceCulture)); } - } internal static string NetRepoInconsistenciesHeader { get { return (string)(ResourceManager.GetObject("NetRepoInconsistenciesHeader", resourceCulture)); } } @@ -535,9 +532,6 @@ internal static string KrakenDownloadThrottled { internal static string KrakenAlreadyRunning { get { return (string)(ResourceManager.GetObject("KrakenAlreadyRunning", resourceCulture)); } } - internal static string KrakenReinstallModule { - get { return (string)(ResourceManager.GetObject("KrakenReinstallModule", resourceCulture)); } - } internal static string NotEnoughSpaceToDownload { get { return (string)(ResourceManager.GetObject("NotEnoughSpaceToDownload", resourceCulture)); } } diff --git a/Core/Properties/Resources.fr-FR.resx b/Core/Properties/Resources.fr-FR.resx index 04975cdfd9..cadee7eaed 100644 --- a/Core/Properties/Resources.fr-FR.resx +++ b/Core/Properties/Resources.fr-FR.resx @@ -206,14 +206,6 @@ Installez le paquet `mono-complete` ou un équivalent pour votre système d'expl Échec du téléchargement de {0} : {1} - - Les mods suivants ont eu leurs métadonnées changées depuis la dernière mise à jour : - -{0} -Vous devriez les réinstaller pour préserver la cohérence avec le répertoire. - -Souhaitez-vous réinstaller maintenant ? - Les incohérences suivantes ont été trouvées : @@ -565,9 +557,6 @@ Pensez à ajouter un jeton d'authentification pour augmenter la limite avant bri Si vous êtes certain que ce n'est pas le cas, alors supprimez : "{0}" - - Changement de métadonnées, réinstallation recommandée : {0} - Pas assez d'espace dans le dossier temporaire pour télécharger les modules ! diff --git a/Core/Properties/Resources.it-IT.resx b/Core/Properties/Resources.it-IT.resx index 3b566b25de..380e81baa1 100644 --- a/Core/Properties/Resources.it-IT.resx +++ b/Core/Properties/Resources.it-IT.resx @@ -206,14 +206,6 @@ Installa il pacchetto `mono-complete` o un pacchetto equivalente per il tuo sist Impossibile scaricare {0}: {1} - - Le seguenti mod hanno cambiato i loro metadati dall'ultimo aggiornamento: - -{0} -Dovresti reinstallarle per mantenere la coerenza con il repository. - -Vuoi reinstallare ora? - Sono state rilevate le seguenti incoerenze: @@ -565,9 +557,6 @@ Prendi in considerazione l'aggiunta di un token di autenticazione per aumentare Se sei sicuro che non sia questo il caso, elimina: "{0}" - - Metadati cambiati, reinstallazione raccomandata: {0} - Spazio insufficiente nella cartella temporanea per scaricare i moduli! diff --git a/Core/Properties/Resources.pl-PL.resx b/Core/Properties/Resources.pl-PL.resx index 1ae9328785..894b4ca80b 100644 --- a/Core/Properties/Resources.pl-PL.resx +++ b/Core/Properties/Resources.pl-PL.resx @@ -206,14 +206,6 @@ Zainstaluj pakiet `mono-complete` lub pasujący do twojego systemu operacyjnego. Nie udało się pobrać {0}: {1} - - Następujące modyfikacje zmieniły swoje metadane od ostatniej aktualizacji: - -{0} -Powinieneś je ponownie zainstalować, aby zachować spójność z repozytorium. - -Czy chcesz je zainstalować ponownie teraz? - Znaleziono następujące niespójności: @@ -565,9 +557,6 @@ Rozważ dodanie tokenu uwierzytelniającego, aby zwiększyć limit ograniczania. Jeśli jesteś pewien, że tak nie jest, to usuń: "{0}" - - Metadane zmienione, zalecana ponowna instalacja: {0} - Za mało miejsca w folderze tymczasowym do pobrania modułów! diff --git a/Core/Properties/Resources.resx b/Core/Properties/Resources.resx index b8c7288962..0bf27a2c1c 100644 --- a/Core/Properties/Resources.resx +++ b/Core/Properties/Resources.resx @@ -148,12 +148,6 @@ Install the `mono-complete` package or equivalent for your operating system.Repositories updated No modules found! Failed to download {0}: {1} - The following mods have had their metadata changed since last update: - -{0} -You should reinstall them in order to preserve consistency with the repository. - -Do you wish to reinstall now? The following inconsistencies were found: Loading modules from {0} repository... Loaded download counts from {0} repository @@ -281,7 +275,6 @@ Consider adding an authentication token to increase the throttling limit. - Metadata changed, reinstallation recommended: {0} Not enough space in temp folder to download modules! Not enough space in cache folder to store modules! Not enough space in game folder to install modules! diff --git a/Core/Properties/Resources.ru-RU.resx b/Core/Properties/Resources.ru-RU.resx index 8aa835422a..1ade0bf639 100644 --- a/Core/Properties/Resources.ru-RU.resx +++ b/Core/Properties/Resources.ru-RU.resx @@ -146,12 +146,6 @@ Репозитории обновлены Не найдено ни одного модуля! Не удалось загрузить «{0}»: {1} - С последнего обновления были изменены метаданные следующих модификаций: - -{0} -Ради сохранения согласованности с репозиторием рекомендуется их переустановка. - -Хотите ли вы переустановить их сейчас? Найдены следующие несоответствия: `any_of` не должно сочетаться с `{0}` {0} желает установить {1}, который принадлежит {2} @@ -277,7 +271,6 @@ https://github.com/KSP-CKAN/CKAN/wiki/SSL-certificate-errors Если вы уверены, что это не так, удалите: "{0}" - Метаданные изменены, рекомендуется переустановка: {0} {0} конфликтует с {1} Необходима {0}, но в ресольвере несовместимая версия Необходима {0}, но установлена несовместимая версия diff --git a/Core/Properties/Resources.zh-CN.resx b/Core/Properties/Resources.zh-CN.resx index 8f2c676bfd..3d80eefdbb 100644 --- a/Core/Properties/Resources.zh-CN.resx +++ b/Core/Properties/Resources.zh-CN.resx @@ -146,12 +146,6 @@ 数据库已更新 没有找到模组! 下载 {0} 失败: {1} - 以下模组自上次更新后更改了它们的元数据: - -{0} -您应该重新安装它们以保持与数据库的一致性。 - -您想要现在重新安装吗? 发现以下冲突: `any_of` 不应该与 `{0}` 结合使用 {0} 想要安装 {1},但该文件已被 {2} 注册 @@ -276,7 +270,6 @@ https://github.com/KSP-CKAN/CKAN/wiki/SSL-certificate-errors 如果您确定这里不是,请删除: "{0}" - 元数据已更改,推荐重新安装: {0} {0} 与 {1} 冲突 需要 {0} ,但解析器内有一个不兼容版本 需要 {0} ,但有一个已安装的不兼容版本 diff --git a/Core/Registry/IRegistryQuerier.cs b/Core/Registry/IRegistryQuerier.cs index c8426f7968..1731a7a6a8 100644 --- a/Core/Registry/IRegistryQuerier.cs +++ b/Core/Registry/IRegistryQuerier.cs @@ -170,28 +170,25 @@ public static bool IsAutodetected(this IRegistryQuerier querier, string identifi /// /// Is the mod installed and does it have a newer version compatible with version - /// We can't update AD mods /// public static bool HasUpdate(this IRegistryQuerier querier, string identifier, GameVersionCriteria version) { CkanModule newest_version; try { + // Check if it's both installed and available newest_version = querier.LatestAvailable(identifier, version); - } - catch (Exception) - { - return false; - } - if (newest_version == null - || !querier.IsInstalled(identifier, false) - || !newest_version.version.IsGreaterThan(querier.InstalledVersion(identifier))) - { - return false; - } - // All quick checks pass. Now check the relationships. - try - { + if (newest_version == null || !querier.IsInstalled(identifier, false)) + { + return false; + } + // Check if the installed module is up to date + if (newest_version.version <= querier.InstalledVersion(identifier) + && !querier.MetadataChanged(identifier)) + { + return false; + } + // All quick checks pass. Now check the relationships. var instMod = querier.InstalledModule(identifier); RelationshipResolver resolver = new RelationshipResolver( new CkanModule[] { newest_version }, @@ -213,6 +210,22 @@ public static bool HasUpdate(this IRegistryQuerier querier, string identifier, G return true; } + private static bool MetadataChanged(this IRegistryQuerier querier, string identifier) + { + try + { + var installed = querier.InstalledModule(identifier)?.Module; + return installed != null + && (!querier.GetModuleByVersion(identifier, installed.version)?.MetadataEquals(installed) + ?? false); + } + catch + { + // Treat exceptions as not-changed + return false; + } + } + /// /// Generate a string describing the range of game versions /// compatible with the given module. diff --git a/Core/Types/CkanModule.cs b/Core/Types/CkanModule.cs index 79249b76e4..c7761da147 100644 --- a/Core/Types/CkanModule.cs +++ b/Core/Types/CkanModule.cs @@ -624,6 +624,79 @@ public override bool Equals(object obj) return Equals((CkanModule)obj); } + public bool MetadataEquals(CkanModule other) + { + if ((install == null) != (other.install == null) + || (install != null + && install.Length != other.install.Length)) + { + return false; + } + else if (install != null) + { + for (int i = 0; i < install.Length; i++) + { + if (!install[i].Equals(other.install[i])) + return false; + } + } + if (install_size != other.install_size) + { + return false; + } + + if (!RelationshipsAreEquivalent(conflicts, other.conflicts)) + return false; + + if (!RelationshipsAreEquivalent(depends, other.depends)) + return false; + + if (!RelationshipsAreEquivalent(recommends, other.recommends)) + return false; + + if (provides != other.provides) + { + if (provides == null || other.provides == null) + return false; + else if (!provides.OrderBy(i => i).SequenceEqual(other.provides.OrderBy(i => i))) + return false; + } + return true; + } + + private static bool RelationshipsAreEquivalent(List a, List b) + { + if (a == b) + // If they're the same exact object they must be equivalent + return true; + + if (a == null || b == null) + // If they're not the same exact object and either is null then must not be equivalent + return false; + + if (a.Count != b.Count) + // If their counts different they must not be equivalent + return false; + + // Sort the lists so we can compare each relationship + var aSorted = a.OrderBy(i => i.ToString()).ToList(); + var bSorted = b.OrderBy(i => i.ToString()).ToList(); + + for (var i = 0; i < a.Count; i++) + { + var aRel = aSorted[i]; + var bRel = bSorted[i]; + + if (!aRel.Equals(bRel)) + { + return false; + } + } + + // If we couldn't find any differences they must be equivalent + return true; + } + public override int GetHashCode() { unchecked diff --git a/Core/Types/Kraken.cs b/Core/Types/Kraken.cs index 5775fe2ec9..41af0fbc95 100644 --- a/Core/Types/Kraken.cs +++ b/Core/Types/Kraken.cs @@ -601,16 +601,4 @@ public InvalidKSPInstanceKraken(string instance, string reason = null, Exception } } - public class ReinstallModuleKraken : Kraken - { - public readonly List Modules; - - public ReinstallModuleKraken(List modules) - : base(string.Format(Properties.Resources.KrakenReinstallModule, - string.Join(", ", modules))) - { - Modules = modules; - } - } - } diff --git a/GUI/Controls/ManageMods.cs b/GUI/Controls/ManageMods.cs index 75d9d0648f..2f65592c17 100644 --- a/GUI/Controls/ManageMods.cs +++ b/GUI/Controls/ManageMods.cs @@ -856,9 +856,12 @@ public void ClearChangeSet() { mod.SetInstallChecked(row, Installed, mod.IsInstalled); } - else if (mod.SelectedMod != mod.InstalledMod?.Module) + else if (mod.InstalledMod != null) { - mod.SelectedMod = mod.InstalledMod?.Module; + var registry = RegistryManager.Instance(Main.Instance.CurrentInstance).registry; + mod.SelectedMod = registry.GetModuleByVersion( + mod.InstalledMod.identifier, mod.InstalledMod.Module.version) + ?? mod.InstalledMod.Module; } mod.SetUpgradeChecked(row, UpdateCol, false); mod.SetReplaceChecked(row, ReplaceCol, false); diff --git a/GUI/Main/MainRepo.cs b/GUI/Main/MainRepo.cs index bd4204e4f7..e7afeee212 100644 --- a/GUI/Main/MainRepo.cs +++ b/GUI/Main/MainRepo.cs @@ -155,20 +155,6 @@ private void PostUpdateRepo(object sender, RunWorkerCompletedEventArgs e) EnableMainWindow(); break; - case ReinstallModuleKraken rmk: - // Re-enable the UI for the install flow - EnableMainWindow(); - Wait.StartWaiting(InstallMods, PostInstallMods, true, - new KeyValuePair, RelationshipResolverOptions>( - rmk.Modules - .Select(m => new ModChange(m, GUIModChangeType.Update)) - .ToList(), - RelationshipResolver.DependsOnlyOpts() - ) - ); - // Don't mess with the UI, let the install flow control it - break; - case Exception exc: AddStatusMessage(Properties.Resources.MainRepoFailed); currentUser.RaiseMessage(exc.Message); diff --git a/GUI/Model/GUIMod.cs b/GUI/Model/GUIMod.cs index 4eddfc741f..d12b35cd99 100644 --- a/GUI/Model/GUIMod.cs +++ b/GUI/Model/GUIMod.cs @@ -135,7 +135,8 @@ public GUIMod(InstalledModule instMod, IRegistryQuerier registry, GameVersionCri IsInstalled = true; IsInstallChecked = true; InstalledMod = instMod; - selectedMod = instMod.Module; + selectedMod = registry.GetModuleByVersion(instMod.identifier, instMod.Module.version) + ?? instMod.Module; IsAutoInstalled = instMod.AutoInstalled; InstallDate = instMod.InstallTime; InstalledVersion = instMod.Module.version.ToString(); diff --git a/GUI/Model/ModChange.cs b/GUI/Model/ModChange.cs index c50d14b663..3a808b4b03 100644 --- a/GUI/Model/ModChange.cs +++ b/GUI/Model/ModChange.cs @@ -87,12 +87,7 @@ public override string ToString() } public virtual string NameAndStatus - { - get - { - return Main.Instance.Manager.Cache.DescribeAvailability(Mod); - } - } + => Main.Instance.Manager.Cache.DescribeAvailability(Mod); private string DescribeGroup(IEnumerable reasons) => reasons.First().DescribeWith(reasons.Skip(1)); @@ -116,24 +111,18 @@ public ModUpgrade(CkanModule mod, GUIModChangeType changeType, CkanModule target } public override string NameAndStatus - { - get - { - return Main.Instance.Manager.Cache.DescribeAvailability(targetMod); - } - } + => Main.Instance.Manager.Cache.DescribeAvailability(targetMod); public override string Description - { - get - { - return string.Format( - Properties.Resources.MainChangesetUpdateSelected, - targetMod.version - ); - } - } + => IsReinstall + ? Properties.Resources.MainChangesetReinstall + : string.Format(Properties.Resources.MainChangesetUpdateSelected, + targetMod.version); public readonly CkanModule targetMod; + + private bool IsReinstall + => targetMod.identifier == Mod.identifier + && targetMod.version == Mod.version; } } diff --git a/GUI/Properties/Resources.Designer.cs b/GUI/Properties/Resources.Designer.cs index 077abed8f7..9a2781f298 100644 --- a/GUI/Properties/Resources.Designer.cs +++ b/GUI/Properties/Resources.Designer.cs @@ -514,6 +514,9 @@ internal static string AllModVersionsInstallNo { internal static string MainChangesetUpdateSelected { get { return (string)(ResourceManager.GetObject("MainChangesetUpdateSelected", resourceCulture)); } } + internal static string MainChangesetReinstall { + get { return (string)(ResourceManager.GetObject("MainChangesetReinstall", resourceCulture)); } + } internal static string MainImportTitle { get { return (string)(ResourceManager.GetObject("MainImportTitle", resourceCulture)); } diff --git a/GUI/Properties/Resources.de-DE.resx b/GUI/Properties/Resources.de-DE.resx index 3d6198f2ca..7fb6f736be 100644 --- a/GUI/Properties/Resources.de-DE.resx +++ b/GUI/Properties/Resources.de-DE.resx @@ -192,6 +192,7 @@ Möchten Sie es wirklich installieren? Installieren Abbrechen Mod-Update ausgewählt vom Nutzer {0}. + Neu installieren (Metadaten geändert) Mod-Import Statuslog Statuslog diff --git a/GUI/Properties/Resources.fr-FR.resx b/GUI/Properties/Resources.fr-FR.resx index b9ed71e33e..a2b731dc71 100644 --- a/GUI/Properties/Resources.fr-FR.resx +++ b/GUI/Properties/Resources.fr-FR.resx @@ -407,6 +407,9 @@ Voulez-vous vraiment les installer ? L'annulation annulera toute l'installation. Mise à jour demandée vers la version {0}. + + Réinstallation (Changement de métadonnées) + Importer des Mods diff --git a/GUI/Properties/Resources.it-IT.resx b/GUI/Properties/Resources.it-IT.resx index 296ae2b9c6..1eec2883dd 100644 --- a/GUI/Properties/Resources.it-IT.resx +++ b/GUI/Properties/Resources.it-IT.resx @@ -407,6 +407,9 @@ Sei sicuro di volerli installare? L'annullamento interromperà l'intera installa Aggiorna la versione selezionata dall'utente alla versione {0}. + + Reinstallazione (Metadati cambiati) + Importa Mod diff --git a/GUI/Properties/Resources.ja-JP.resx b/GUI/Properties/Resources.ja-JP.resx index d17585b50d..26844c11ad 100644 --- a/GUI/Properties/Resources.ja-JP.resx +++ b/GUI/Properties/Resources.ja-JP.resx @@ -193,6 +193,7 @@ Try to move {2} out of {3} and restart CKAN. インストール 取消 選択されたものをバージョン{0}にアップデートする。 + () Modインポート Mod (*.zip)|*.zip ステータスログ diff --git a/GUI/Properties/Resources.ko-KR.resx b/GUI/Properties/Resources.ko-KR.resx index a4979a746f..a36d5b2ed2 100644 --- a/GUI/Properties/Resources.ko-KR.resx +++ b/GUI/Properties/Resources.ko-KR.resx @@ -194,6 +194,7 @@ 설치 취소하기 유저가 선택한 것을 버전 {0}으로 업데이트 하기. + () 유저가 선택한 모드를 설치하기. 모드들 가져오기 모드들 (*.zip)|*.zip diff --git a/GUI/Properties/Resources.pl-PL.resx b/GUI/Properties/Resources.pl-PL.resx index 135a27e59c..eacd149c7c 100644 --- a/GUI/Properties/Resources.pl-PL.resx +++ b/GUI/Properties/Resources.pl-PL.resx @@ -407,6 +407,9 @@ Na pewno chcesz je zainstalować? Anulowanie przerwie całą instalację. Aktualizacja wybrana przez użytkownika do wersji {0}. + + Zainstaluj ponownie (Metadane zmienione) + Importuj modyfikacje diff --git a/GUI/Properties/Resources.resx b/GUI/Properties/Resources.resx index de4ab5928c..64e79e4fe9 100644 --- a/GUI/Properties/Resources.resx +++ b/GUI/Properties/Resources.resx @@ -225,6 +225,7 @@ Are you sure you want to install them? Cancelling will abort the entire installa Install Cancel Update selected by user to version {0}. + Re-install (metadata changed) Import Mods Mods (*.zip)|*.zip Status log diff --git a/GUI/Properties/Resources.ru-RU.resx b/GUI/Properties/Resources.ru-RU.resx index 82a91c8979..d21dfbf131 100644 --- a/GUI/Properties/Resources.ru-RU.resx +++ b/GUI/Properties/Resources.ru-RU.resx @@ -191,6 +191,7 @@ Установить Отмена Обновить выбранное пользователем до версии {0}. + Переустановка (Метаданные изменены) Импортировать модификации Модификации (*.zip)|*.zip Журнал diff --git a/GUI/Properties/Resources.zh-CN.resx b/GUI/Properties/Resources.zh-CN.resx index e323f22bfe..105e8d3f5d 100644 --- a/GUI/Properties/Resources.zh-CN.resx +++ b/GUI/Properties/Resources.zh-CN.resx @@ -188,6 +188,7 @@ 安装 取消 用户选择更新到 {0} 版本. + 重新安装 (元数据已更改) 导入Mod Mods (*.zip)|*.zip 状态日志