add installation without gui & pass arguments to gui

This commit is contained in:
2024-06-20 06:12:28 +02:00
parent f3b2d07117
commit 00de4d8708
4 changed files with 38 additions and 12 deletions

View File

@@ -13,6 +13,15 @@ public partial class Form1
private bool currentUpdating = false;
private UpdateCheckResult lastUpdateCheckResult = null;
public Form1(string modpackConfig, string profilePath) : this()
{
if (!string.IsNullOrWhiteSpace(modpackConfig))
LoadUpdateConfigFile(modpackConfig);
if (!string.IsNullOrWhiteSpace(profilePath))
LoadMinecraftProfile(profilePath);
}
public Form1()
{
InitializeComponent();
@@ -84,10 +93,11 @@ public partial class Form1
private void LoadUpdateConfigFile(string filePath)
{
RadTextBoxControl_ModpackConfig.Text = filePath;
try
{
if (IsUpdateConfigLoaded())
updateConfig = (ModpackConfig)ModpackConfig.LoadFromUrl(filePath);
updateConfig = ModpackConfig.LoadFromUrl(filePath);
}
catch
{
@@ -222,7 +232,8 @@ public partial class Form1
{
if (Directory.Exists(AppConfig.Instance.LastMinecraftProfilePath))
LoadMinecraftProfile(AppConfig.Instance.LastMinecraftProfilePath);
LoadUpdateConfigFile(AppConfig.Instance.LastConfigFilePath);
if (!string.IsNullOrWhiteSpace(AppConfig.Instance.LastConfigFilePath))
LoadUpdateConfigFile(AppConfig.Instance.LastConfigFilePath);
}
private async void Form1_Shown(object sender, EventArgs e)