improvements for first installation
This commit is contained in:
@@ -65,6 +65,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
// Check install actions
|
||||
if (!exists)
|
||||
{
|
||||
result.IsInstalled = false;
|
||||
|
||||
if (installInfos is not null && installInfos.IsPublic && installInfos.Actions.Count != 0)
|
||||
{
|
||||
var actions = installInfos.Actions.Where(n => n.Side.IsSide(options.Side) && (!n.IsExtra || options.IncludeExtras));
|
||||
@@ -81,19 +83,17 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
}
|
||||
|
||||
// Check update actions
|
||||
if (exists || options.AllowUpdaterAfterInstall)
|
||||
if (!result.HasError && (exists || options.AllowUpdaterAfterInstall))
|
||||
{
|
||||
updateInfos = await DownloadUpdateInfos();
|
||||
|
||||
if (updateInfos is not null && updateInfos.Updates.Count != 0)
|
||||
{
|
||||
var updatesOrderes = updateInfos.Updates.Where(n => n.IsPublic || options.IncludeNonPublic).OrderByDescending(n => n.Version);
|
||||
result.LatestVersion = updatesOrderes.First().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
|
||||
result.IsInstalled = true;
|
||||
|
||||
while (checkingVersion is not null && checkingVersion.Version > curVersion)
|
||||
{
|
||||
@@ -111,6 +111,9 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
|
||||
|
||||
result.Actions.InsertRange(actionsZeroIndex, actionsToAdd);
|
||||
|
||||
if (result.LatestVersion < checkingVersion.Version)
|
||||
result.LatestVersion = checkingVersion.Version;
|
||||
|
||||
checkingVersionIndex += 1;
|
||||
checkingVersion = updatesOrderes.ElementAtOrDefault(checkingVersionIndex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user