fix loading everything on startup

This commit is contained in:
2024-06-22 18:26:58 +02:00
parent bf38ed6df6
commit 1fba037e3f

View File

@@ -45,38 +45,12 @@ public partial class Form1
{ {
RadTextBoxControl_MinecraftProfileFolder.Text = folderPath; RadTextBoxControl_MinecraftProfileFolder.Text = folderPath;
AppConfig.Instance.LastMinecraftProfilePath = folderPath; AppConfig.Instance.LastMinecraftProfilePath = folderPath;
if (string.IsNullOrWhiteSpace(folderPath))
return;
try
{
modpackInfo = ModpackInfo.TryLoad(folderPath);
RadTextBoxControl_ModpackConfig.Text = modpackInfo.ConfigUrl;
radTextBoxControl_InstallKey.Text = modpackInfo.ExtrasKey;
}
catch
{
}
CheckStatusAndUpdate(); CheckStatusAndUpdate();
} }
private void LoadUpdateConfigFile(string filePath) private void LoadUpdateConfigFile(string filePath)
{ {
RadTextBoxControl_ModpackConfig.Text = filePath; RadTextBoxControl_ModpackConfig.Text = filePath;
if (string.IsNullOrWhiteSpace(filePath))
return;
try
{
updateConfig = ModpackConfig.LoadFromUrl(filePath);
}
catch (Exception)
{
}
CheckStatusAndUpdate(); CheckStatusAndUpdate();
} }
@@ -106,6 +80,24 @@ public partial class Form1
private bool CheckStatus() private bool CheckStatus()
{ {
try
{
modpackInfo = ModpackInfo.TryLoad(RadTextBoxControl_MinecraftProfileFolder.Text.Trim());
RadTextBoxControl_ModpackConfig.Text = modpackInfo.ConfigUrl;
radTextBoxControl_InstallKey.Text = modpackInfo.ExtrasKey;
}
catch
{
}
try
{
updateConfig = ModpackConfig.LoadFromUrl(RadTextBoxControl_ModpackConfig.Text);
}
catch (Exception)
{
}
if (modpackInfo == null || string.IsNullOrWhiteSpace(RadTextBoxControl_MinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/) if (modpackInfo == null || string.IsNullOrWhiteSpace(RadTextBoxControl_MinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/)
{ {
SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.general_warning_sign, SvgImageSize.Small)); SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.general_warning_sign, SvgImageSize.Small));