From 1fba037e3feff126fc21b7b8f9f2449fc142cf36 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Sat, 22 Jun 2024 18:26:58 +0200 Subject: [PATCH] fix loading everything on startup --- ModpackUpdater/Form1.cs | 44 +++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/ModpackUpdater/Form1.cs b/ModpackUpdater/Form1.cs index a7a41f9..c9a0ec2 100644 --- a/ModpackUpdater/Form1.cs +++ b/ModpackUpdater/Form1.cs @@ -45,38 +45,12 @@ public partial class Form1 { RadTextBoxControl_MinecraftProfileFolder.Text = 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(); } private void LoadUpdateConfigFile(string filePath) { RadTextBoxControl_ModpackConfig.Text = filePath; - - if (string.IsNullOrWhiteSpace(filePath)) - return; - - try - { - updateConfig = ModpackConfig.LoadFromUrl(filePath); - } - catch (Exception) - { - } - CheckStatusAndUpdate(); } @@ -106,6 +80,24 @@ public partial class Form1 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*/) { SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppSymbolFactory.Instance.GetSvgImage(AppSymbols.general_warning_sign, SvgImageSize.Small));