load modpack info before modpack installer
This commit is contained in:
@@ -10,6 +10,7 @@ namespace ModpackUpdater;
|
||||
|
||||
public partial class Form1
|
||||
{
|
||||
private ModpackInfo modpackInfo = null;
|
||||
private ModpackConfig updateConfig = new();
|
||||
private bool currentUpdating = false;
|
||||
private UpdateCheckResult lastUpdateCheckResult = null;
|
||||
@@ -65,7 +66,7 @@ public partial class Form1
|
||||
{
|
||||
bool CheckStatusRet;
|
||||
|
||||
if (!IsMinecaftProfileLoaded() || !MinecraftProfileChecker.CheckProfile(GetMinecraftProfilePath()))
|
||||
if (!IsMinecaftProfileLoaded())
|
||||
{
|
||||
SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.general_warning_sign, SvgImageSize.Small));
|
||||
CheckStatusRet = false;
|
||||
@@ -98,7 +99,21 @@ public partial class Form1
|
||||
RadTextBoxControl_MinecraftProfileFolder.Text = folderPath;
|
||||
|
||||
if (IsUpdateConfigLoaded())
|
||||
RadButton_CheckForUpdates.PerformClick();
|
||||
{
|
||||
try
|
||||
{
|
||||
modpackInfo = ModpackInfo.TryLoad(folderPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
RadTextBoxControl_MinecraftProfileFolder.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(RadTextBoxControl_ModpackConfig.Text) && !string.IsNullOrWhiteSpace(modpackInfo?.ConfigUrl))
|
||||
LoadUpdateConfigFile(modpackInfo.ConfigUrl);
|
||||
else
|
||||
RadButton_CheckForUpdates.PerformClick();
|
||||
}
|
||||
else
|
||||
ClearStatus();
|
||||
}
|
||||
@@ -127,7 +142,7 @@ public partial class Form1
|
||||
|
||||
private async Task ExecuteUpdate(bool doInstall)
|
||||
{
|
||||
var updater = new ModpackInstaller(updateConfig, GetMinecraftProfilePath());
|
||||
var updater = new ModpackInstaller(updateConfig, modpackInfo);
|
||||
updater.InstallProgessUpdated += Update_InstallProgessUpdated;
|
||||
updater.CheckingProgressUpdated += Updated_CheckingProgresssUpdated;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user