remove extras toogle from ui

This commit is contained in:
2024-06-20 22:37:54 +02:00
parent 3be25d7070
commit ee46f7272e
5 changed files with 1 additions and 32 deletions

View File

@@ -42,10 +42,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
InstallInfos installInfos = null; InstallInfos installInfos = null;
UpdateInfos updateInfos = null; UpdateInfos updateInfos = null;
var hasConfig = modpackInfo.Exists; var hasConfig = modpackInfo.Exists;
var result = new UpdateCheckResult var result = new UpdateCheckResult();
{
HasExtras = options.IncludeExtraActions
};
if (updateConfig.Maintenance && !options.IgnoreMaintenance) if (updateConfig.Maintenance && !options.IgnoreMaintenance)
{ {
@@ -177,7 +174,6 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
// Save new modpack info // Save new modpack info
modpackInfo.Version = checkResult.LatestVersion; modpackInfo.Version = checkResult.LatestVersion;
modpackInfo.ConfigUrl = updateConfig.ConfigUrl; modpackInfo.ConfigUrl = updateConfig.ConfigUrl;
modpackInfo.IncludeExtras = checkResult.HasExtras;
modpackInfo.Save(); modpackInfo.Save();
// Delete cached zip files // Delete cached zip files

View File

@@ -11,5 +11,4 @@ public class UpdateCheckResult
public bool HasError { get; set; } public bool HasError { get; set; }
public bool IsInMaintenance { get; set; } public bool IsInMaintenance { get; set; }
public bool HasUpdates => !IsInstalled || CurrentVersion < LatestVersion; public bool HasUpdates => !IsInstalled || CurrentVersion < LatestVersion;
public bool HasExtras { get; set; }
} }

View File

@@ -11,7 +11,6 @@ public class ModpackInfo
[JsonConverter(typeof(VersionConverter))] [JsonConverter(typeof(VersionConverter))]
public Version Version { get; set; } public Version Version { get; set; }
public string ConfigUrl { get; set; } public string ConfigUrl { get; set; }
public bool IncludeExtras { get; set; }
[JsonIgnore] [JsonIgnore]
public string LocaLPath { get; private set; } public string LocaLPath { get; private set; }
[JsonIgnore] [JsonIgnore]

View File

@@ -48,7 +48,6 @@ namespace ModpackUpdater
RadButton_SearchMinecraftProfileFolder = new Telerik.WinControls.UI.RadButton(); RadButton_SearchMinecraftProfileFolder = new Telerik.WinControls.UI.RadButton();
tableLayoutPanel1 = new TableLayoutPanel(); tableLayoutPanel1 = new TableLayoutPanel();
radButton_RefreshConfig = new Telerik.WinControls.UI.RadButton(); radButton_RefreshConfig = new Telerik.WinControls.UI.RadButton();
radCheckBox_IncludeExtras = new Telerik.WinControls.UI.RadCheckBox();
((System.ComponentModel.ISupportInitialize)RadLabel1).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadLabel1).BeginInit();
((System.ComponentModel.ISupportInitialize)RadLabel2).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadLabel2).BeginInit();
((System.ComponentModel.ISupportInitialize)RadLabel3).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadLabel3).BeginInit();
@@ -62,7 +61,6 @@ namespace ModpackUpdater
((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).BeginInit();
tableLayoutPanel1.SuspendLayout(); tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)radButton_RefreshConfig).BeginInit(); ((System.ComponentModel.ISupportInitialize)radButton_RefreshConfig).BeginInit();
((System.ComponentModel.ISupportInitialize)radCheckBox_IncludeExtras).BeginInit();
((System.ComponentModel.ISupportInitialize)this).BeginInit(); ((System.ComponentModel.ISupportInitialize)this).BeginInit();
SuspendLayout(); SuspendLayout();
// //
@@ -222,7 +220,6 @@ namespace ModpackUpdater
tableLayoutPanel1.Controls.Add(RadButton_PasteModpackConfig, 3, 3); tableLayoutPanel1.Controls.Add(RadButton_PasteModpackConfig, 3, 3);
tableLayoutPanel1.Controls.Add(RadButton_Install, 5, 5); tableLayoutPanel1.Controls.Add(RadButton_Install, 5, 5);
tableLayoutPanel1.Controls.Add(radButton_RefreshConfig, 2, 3); tableLayoutPanel1.Controls.Add(radButton_RefreshConfig, 2, 3);
tableLayoutPanel1.Controls.Add(radCheckBox_IncludeExtras, 0, 5);
tableLayoutPanel1.Dock = DockStyle.Fill; tableLayoutPanel1.Dock = DockStyle.Fill;
tableLayoutPanel1.Location = new Point(0, 0); tableLayoutPanel1.Location = new Point(0, 0);
tableLayoutPanel1.Name = "tableLayoutPanel1"; tableLayoutPanel1.Name = "tableLayoutPanel1";
@@ -248,17 +245,6 @@ namespace ModpackUpdater
radButton_RefreshConfig.Text = "Reload"; radButton_RefreshConfig.Text = "Reload";
radButton_RefreshConfig.Click += RadButton_RefreshConfig_Click; radButton_RefreshConfig.Click += RadButton_RefreshConfig_Click;
// //
// radCheckBox_IncludeExtras
//
radCheckBox_IncludeExtras.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
radCheckBox_IncludeExtras.AutoSize = false;
radCheckBox_IncludeExtras.Location = new Point(3, 147);
radCheckBox_IncludeExtras.Name = "radCheckBox_IncludeExtras";
radCheckBox_IncludeExtras.Size = new Size(144, 24);
radCheckBox_IncludeExtras.TabIndex = 12;
radCheckBox_IncludeExtras.Text = "Include extra files";
radCheckBox_IncludeExtras.ToggleStateChanged += RadCheckBox_IncludeExtras_ToggleStateChanged;
//
// Form1 // Form1
// //
AutoScaleBaseSize = new Size(7, 15); AutoScaleBaseSize = new Size(7, 15);
@@ -287,7 +273,6 @@ namespace ModpackUpdater
((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).EndInit(); ((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).EndInit();
tableLayoutPanel1.ResumeLayout(false); tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)radButton_RefreshConfig).EndInit(); ((System.ComponentModel.ISupportInitialize)radButton_RefreshConfig).EndInit();
((System.ComponentModel.ISupportInitialize)radCheckBox_IncludeExtras).EndInit();
((System.ComponentModel.ISupportInitialize)this).EndInit(); ((System.ComponentModel.ISupportInitialize)this).EndInit();
ResumeLayout(false); ResumeLayout(false);
} }
@@ -305,6 +290,5 @@ namespace ModpackUpdater
internal Telerik.WinControls.UI.RadButton RadButton_PasteModpackConfig; internal Telerik.WinControls.UI.RadButton RadButton_PasteModpackConfig;
private TableLayoutPanel tableLayoutPanel1; private TableLayoutPanel tableLayoutPanel1;
private Telerik.WinControls.UI.RadButton radButton_RefreshConfig; private Telerik.WinControls.UI.RadButton radButton_RefreshConfig;
private Telerik.WinControls.UI.RadCheckBox radCheckBox_IncludeExtras;
} }
} }

View File

@@ -35,7 +35,6 @@ public partial class Form1
RadButton_Install.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SvgImageSize.Small); RadButton_Install.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.software_installer, SvgImageSize.Small);
RadButton_CheckForUpdates.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SvgImageSize.Small); RadButton_CheckForUpdates.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.update_done, SvgImageSize.Small);
RadButton_EditModpackConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.wrench, SvgImageSize.Small);
radButton_RefreshConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.refresh, SvgImageSize.Small); radButton_RefreshConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.refresh, SvgImageSize.Small);
RadButton_SearchMinecraftProfileFolder.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.opened_folder, SvgImageSize.Small); RadButton_SearchMinecraftProfileFolder.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.opened_folder, SvgImageSize.Small);
RadButton_SearchModpackConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.opened_folder, SvgImageSize.Small); RadButton_SearchModpackConfig.SvgImage = AppSymbolFactory.Instance.GetSvgImage(AppSymbols.opened_folder, SvgImageSize.Small);
@@ -113,7 +112,6 @@ public partial class Form1
LoadUpdateConfigFile(modpackInfo.ConfigUrl); LoadUpdateConfigFile(modpackInfo.ConfigUrl);
else else
RadButton_CheckForUpdates.PerformClick(); RadButton_CheckForUpdates.PerformClick();
radCheckBox_IncludeExtras.Checked = modpackInfo.IncludeExtras;
} }
else else
ClearStatus(); ClearStatus();
@@ -262,12 +260,10 @@ public partial class Form1
{ {
AppConfig.Instance.LastMinecraftProfilePath = RadTextBoxControl_MinecraftProfileFolder.Text; AppConfig.Instance.LastMinecraftProfilePath = RadTextBoxControl_MinecraftProfileFolder.Text;
AppConfig.Instance.LastConfigFilePath = RadTextBoxControl_ModpackConfig.Text; AppConfig.Instance.LastConfigFilePath = RadTextBoxControl_ModpackConfig.Text;
AppConfig.Instance.LastIncludeExtras = radCheckBox_IncludeExtras.Checked;
} }
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
radCheckBox_IncludeExtras.Checked = updateOptions.IncludeExtraActions || AppConfig.Instance.LastIncludeExtras;
if (Directory.Exists(AppConfig.Instance.LastMinecraftProfilePath)) if (Directory.Exists(AppConfig.Instance.LastMinecraftProfilePath))
LoadMinecraftProfile(AppConfig.Instance.LastMinecraftProfilePath); LoadMinecraftProfile(AppConfig.Instance.LastMinecraftProfilePath);
if (!string.IsNullOrWhiteSpace(AppConfig.Instance.LastConfigFilePath)) if (!string.IsNullOrWhiteSpace(AppConfig.Instance.LastConfigFilePath))
@@ -285,9 +281,4 @@ public partial class Form1
Application.Restart(); Application.Restart();
} }
} }
private void RadCheckBox_IncludeExtras_ToggleStateChanged(object sender, StateChangedEventArgs args)
{
updateOptions.IncludeExtraActions = radCheckBox_IncludeExtras.Checked;
}
} }