add maintenance mode & improve & bugfixing

This commit is contained in:
2024-06-20 06:55:25 +02:00
parent c31cc3aa20
commit fc27fc1c34
9 changed files with 75 additions and 44 deletions

View File

@@ -12,20 +12,17 @@ public partial class Form1
private ModpackConfig updateConfig = new();
private bool currentUpdating = false;
private UpdateCheckResult lastUpdateCheckResult = null;
private readonly bool allowUpdateCheck;
private readonly bool allowUpdaterAfterInstall;
private readonly Side side;
private readonly UpdateCheckOptionsAdv updateOptions;
public Form1(string modpackConfig, string profilePath, Side side, bool allowUpdaterAfterInstall, bool allowUpdateCheck) : this()
public Form1(UpdateCheckOptionsAdv updateOptions) : this()
{
this.allowUpdaterAfterInstall = allowUpdaterAfterInstall;
this.side = side;
this.updateOptions = updateOptions;
if (!string.IsNullOrWhiteSpace(modpackConfig))
LoadUpdateConfigFile(modpackConfig);
if (!string.IsNullOrWhiteSpace(updateOptions.ModpackConfig))
LoadUpdateConfigFile(updateOptions.ModpackConfig);
if (!string.IsNullOrWhiteSpace(profilePath))
LoadMinecraftProfile(profilePath);
if (!string.IsNullOrWhiteSpace(updateOptions.ProfileFolder))
LoadMinecraftProfile(updateOptions.ProfileFolder);
}
public Form1()
@@ -129,7 +126,7 @@ public partial class Form1
try
{
lastUpdateCheckResult = await updater.Check(side, allowUpdaterAfterInstall);
lastUpdateCheckResult = await updater.Check(updateOptions);
}
catch
{
@@ -245,7 +242,7 @@ public partial class Form1
private async void Form1_Shown(object sender, EventArgs e)
{
var updater = new AppUpdater();
if (allowUpdateCheck && await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info) == DialogResult.Yes)
if (!updateOptions.NoUpdate && await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info) == DialogResult.Yes)
{
SetStatus(LangRes.StatusText_InstallingAppUpdate, MySymbols.icons8_software_installer_16px);
Enabled = false;