some fixes

This commit is contained in:
2024-10-03 15:46:06 +02:00
parent cd929485d0
commit ee69d8af56
4 changed files with 13 additions and 12 deletions

View File

@@ -59,6 +59,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
}
installInfos = await DownloadInstallInfos();
result.CurrentVersion = modpackInfo.Version ?? new Version("0.0.0.0");
var curVersion = result.CurrentVersion;
// Check install actions
if (!exists)
@@ -70,7 +72,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
{
result.Actions.AddRange(actions);
result.LatestVersion = installInfos.Version;
result.CurrentVersion = installInfos.Version;
curVersion = installInfos.Version;
}
}
@@ -87,15 +89,13 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
{
var updatesOrderes = updateInfos.Updates.Where(n => n.IsPublic || options.IncludeNonPublic).OrderByDescending(n => n.Version);
result.LatestVersion = updatesOrderes.First().Version;
if (exists)
result.CurrentVersion = modpackInfo.Version;
result.IsInstalled = true;
var checkingVersionIndex = 0;
var checkingVersion = updatesOrderes.ElementAtOrDefault(checkingVersionIndex);
var actionsZeroIndex = result.Actions.Count; // Ensure we insert update actions behind install actions
while (checkingVersion is not null && checkingVersion.Version > result.CurrentVersion)
while (checkingVersion is not null && checkingVersion.Version > curVersion)
{
var actionsToAdd = new List<UpdateAction>();