This commit is contained in:
2024-06-20 06:30:24 +02:00
parent 00de4d8708
commit c31cc3aa20
6 changed files with 43 additions and 12 deletions

View File

@@ -12,9 +12,15 @@ 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;
public Form1(string modpackConfig, string profilePath) : this()
public Form1(string modpackConfig, string profilePath, Side side, bool allowUpdaterAfterInstall, bool allowUpdateCheck) : this()
{
this.allowUpdaterAfterInstall = allowUpdaterAfterInstall;
this.side = side;
if (!string.IsNullOrWhiteSpace(modpackConfig))
LoadUpdateConfigFile(modpackConfig);
@@ -123,7 +129,7 @@ public partial class Form1
try
{
lastUpdateCheckResult = await updater.Check();
lastUpdateCheckResult = await updater.Check(side, allowUpdaterAfterInstall);
}
catch
{
@@ -239,7 +245,7 @@ public partial class Form1
private async void Form1_Shown(object sender, EventArgs e)
{
var updater = new AppUpdater();
if (await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info) == DialogResult.Yes)
if (allowUpdateCheck && 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;