public void HasUpdate_WithUpgradeableManuallyInstalledMod_ReturnsTrue() { // Arrange using (var gameInstWrapper = new DisposableKSP()) { CkanModule mod = CkanModule.FromJson(@"{ ""spec_version"": ""v1.4"", ""identifier"": ""AutoDetectedMod"", ""version"": ""1.0"", ""ksp_version"": ""1.11.1"", ""download"": ""https://mymods/AD/1.0"" }"); registry.AddAvailable(mod); GameInstance gameInst = gameInstWrapper.KSP; registry.RegisterDll(gameInst, Path.Combine( gameInst.GameDir(), "GameData", $"{mod.identifier}.dll")); GameVersionCriteria crit = new GameVersionCriteria(mod.ksp_version); // Act bool has = registry.HasUpdate(mod.identifier, crit); // Assert Assert.IsTrue(has, "Can't upgrade manually installed DLL"); } }
public GUIMod(CkanModule mod, Registry registry, KSPVersion ksp_version) { //Currently anything which could alter these causes a full reload of the modlist // If this is ever changed these could be moved into the properties Mod = mod; IsInstalled = registry.IsInstalled(mod.identifier); IsInstallChecked = IsInstalled; HasUpdate = registry.HasUpdate(mod.identifier); IsIncompatible = !mod.IsCompatibleKSP(ksp_version); IsAutodetected = registry.IsAutodetected(mod.identifier); Authors = mod.author == null ? "N/A" : String.Join(",", mod.author); var installedVersion = registry.InstalledVersion(mod.identifier); var latestVersion = mod.version; var kspVersion = mod.ksp_version; InstalledVersion = installedVersion != null?installedVersion.ToString() : "-"; LatestVersion = latestVersion != null?latestVersion.ToString() : "-"; KSPversion = kspVersion != null?kspVersion.ToString() : "-"; Abstract = mod.@abstract; Homepage = mod.resources != null && mod.resources.homepage != null ? (object)mod.resources.homepage : "N/A"; Identifier = mod.identifier; }