load modpack info before modpack installer

This commit is contained in:
2024-06-20 15:05:01 +02:00
parent 604d35856f
commit c97a04c4ce
6 changed files with 64 additions and 33 deletions

View File

@@ -73,8 +73,9 @@ public static class Program
private static void InstallWithoutGui(UpdateCheckOptionsAdv updateOptions, bool silent)
{
var config = ModpackConfig.LoadFromUrl(updateOptions.ModpackConfig);
var installer = new ModpackInstaller(config, updateOptions.ProfileFolder);
var info = ModpackInfo.TryLoad(updateOptions.ProfileFolder);
var config = ModpackConfig.LoadFromUrl(CheckModpackConfigUrl(updateOptions.ModpackConfig, info));
var installer = new ModpackInstaller(config, info);
var result = installer.Check(updateOptions).Result;
if (!silent && !updateOptions.NoUpdate && new AppUpdater().Check().Result)
@@ -89,4 +90,11 @@ public static class Program
else if (!silent)
Console.WriteLine("No updates available");
}
private static string CheckModpackConfigUrl(string configUrl, ModpackInfo info)
{
if (string.IsNullOrWhiteSpace(configUrl) && !string.IsNullOrWhiteSpace(info.ConfigUrl))
return info.ConfigUrl;
return configUrl;
}
}