diff --git a/CreamInstaller/Components/CustomTreeView.cs b/CreamInstaller/Components/CustomTreeView.cs
index bec04e8..2bf53c5 100644
--- a/CreamInstaller/Components/CustomTreeView.cs
+++ b/CreamInstaller/Components/CustomTreeView.cs
@@ -155,12 +155,13 @@ internal class CustomTreeView : TreeView
this.checkBoxBounds[selection] = RectangleToClient(checkBoxBounds);
- if (selection.Koaloader && selection.KoaloaderProxy is not null)
+ string proxy = selection.KoaloaderProxy ?? ProgramSelection.DefaultKoaloaderProxy;
+ if (selection.Koaloader && proxy is not null)
{
comboBoxFont ??= new(font.FontFamily, 6, font.Style, font.Unit, font.GdiCharSet, font.GdiVerticalFont);
ComboBoxState comboBoxState = Enabled ? ComboBoxState.Normal : ComboBoxState.Disabled;
- text = selection.KoaloaderProxy + ".dll";
+ text = proxy + ".dll";
size = TextRenderer.MeasureText(graphics, text, comboBoxFont) + new Size(6, 0);
int padding = 2;
bounds = new(bounds.X + bounds.Width, bounds.Y + padding / 2, size.Width, bounds.Height - padding);
@@ -237,7 +238,7 @@ internal class CustomTreeView : TreeView
if (canUse)
_ = comboBoxDropDown.Items.Add(new ToolStripButton(proxy + ".dll", null, (s, e) =>
{
- pair.Key.KoaloaderProxy = proxy;
+ pair.Key.KoaloaderProxy = proxy == ProgramSelection.DefaultKoaloaderProxy ? null : proxy;
ProgramData.UpdateKoaloaderProxyChoices();
Invalidate();
})
diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj
index 2905c95..261b284 100644
--- a/CreamInstaller/CreamInstaller.csproj
+++ b/CreamInstaller/CreamInstaller.csproj
@@ -5,7 +5,7 @@
True
Resources\ini.ico
true
- 4.1.5.2
+ 4.2.0.0
Resources\ini.ico
LICENSE
2021, pointfeev (https://github.com/pointfeev)
diff --git a/CreamInstaller/Forms/SelectDialogForm.cs b/CreamInstaller/Forms/SelectDialogForm.cs
index 295c1cb..e31e5f7 100644
--- a/CreamInstaller/Forms/SelectDialogForm.cs
+++ b/CreamInstaller/Forms/SelectDialogForm.cs
@@ -4,7 +4,6 @@ using CreamInstaller.Utility;
using System;
using System.Collections.Generic;
using System.Drawing;
-using System.IO;
using System.Linq;
using System.Windows.Forms;
@@ -41,7 +40,7 @@ internal partial class SelectDialogForm : CustomForm
allCheckBox.Enabled = true;
acceptButton.Enabled = selected.Any();
saveButton.Enabled = acceptButton.Enabled;
- loadButton.Enabled = ProgramData.ReadChoices() is not null;
+ loadButton.Enabled = ProgramData.ReadProgramChoices() is not null;
OnResize(null, null);
Resize += OnResize;
return ShowDialog() == DialogResult.OK ? selected : null;
@@ -92,7 +91,7 @@ internal partial class SelectDialogForm : CustomForm
private void OnLoad(object sender, EventArgs e)
{
- List<(Platform platform, string id)> choices = ProgramData.ReadChoices();
+ List<(Platform platform, string id)> choices = ProgramData.ReadProgramChoices();
if (choices is null) return;
foreach (TreeNode node in selectionTreeView.Nodes)
{
@@ -106,7 +105,7 @@ internal partial class SelectDialogForm : CustomForm
List<(Platform platform, string id)> choices = new();
foreach (TreeNode node in selectionTreeView.Nodes.Cast().Where(n => n.Checked))
choices.Add(((Platform)node.Tag, node.Name));
- ProgramData.WriteChoices(choices);
- loadButton.Enabled = File.Exists(ProgramData.ChoicesPath);
+ ProgramData.WriteProgramChoices(choices);
+ loadButton.Enabled = ProgramData.ReadProgramChoices() is not null;
}
}
diff --git a/CreamInstaller/Forms/SelectForm.Designer.cs b/CreamInstaller/Forms/SelectForm.Designer.cs
index f6ade5a..b52a28f 100644
--- a/CreamInstaller/Forms/SelectForm.Designer.cs
+++ b/CreamInstaller/Forms/SelectForm.Designer.cs
@@ -20,25 +20,29 @@ namespace CreamInstaller
private void InitializeComponent()
{
- this.installButton = new();
- this.cancelButton = new();
- this.programsGroupBox = new();
- this.koaloaderFlowPanel = new();
- this.koaloaderAllCheckBox = new();
- this.noneFoundLabel = new();
- this.blockedGamesFlowPanel = new();
- this.blockedGamesCheckBox = new();
- this.blockProtectedHelpButton = new();
- this.selectionTreeView = new();
- this.allCheckBoxLayoutPanel = new();
- this.allCheckBox = new();
- this.progressBar = new();
- this.progressLabel = new();
- this.scanButton = new();
- this.uninstallButton = new();
- this.progressLabelGames = new();
- this.progressLabelDLCs = new();
- this.sortCheckBox = new();
+ this.installButton = new System.Windows.Forms.Button();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.programsGroupBox = new System.Windows.Forms.GroupBox();
+ this.koaloaderFlowPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.koaloaderAllCheckBox = new System.Windows.Forms.CheckBox();
+ this.noneFoundLabel = new System.Windows.Forms.Label();
+ this.blockedGamesFlowPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.blockedGamesCheckBox = new System.Windows.Forms.CheckBox();
+ this.blockProtectedHelpButton = new System.Windows.Forms.Button();
+ this.selectionTreeView = new CreamInstaller.Components.CustomTreeView();
+ this.allCheckBoxLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.allCheckBox = new System.Windows.Forms.CheckBox();
+ this.progressBar = new System.Windows.Forms.ProgressBar();
+ this.progressLabel = new System.Windows.Forms.Label();
+ this.scanButton = new System.Windows.Forms.Button();
+ this.uninstallButton = new System.Windows.Forms.Button();
+ this.progressLabelGames = new System.Windows.Forms.Label();
+ this.progressLabelDLCs = new System.Windows.Forms.Label();
+ this.sortCheckBox = new System.Windows.Forms.CheckBox();
+ this.saveButton = new System.Windows.Forms.Button();
+ this.loadButton = new System.Windows.Forms.Button();
+ this.resetKoaloaderButton = new System.Windows.Forms.Button();
+ this.resetButton = new System.Windows.Forms.Button();
this.programsGroupBox.SuspendLayout();
this.koaloaderFlowPanel.SuspendLayout();
this.blockedGamesFlowPanel.SuspendLayout();
@@ -47,85 +51,87 @@ namespace CreamInstaller
//
// installButton
//
- this.installButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
+ this.installButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.installButton.AutoSize = true;
- this.installButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ this.installButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.installButton.Enabled = false;
- this.installButton.FlatStyle = FlatStyle.System;
- this.installButton.Location = new Point(420, 325);
+ this.installButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.installButton.Location = new System.Drawing.Point(423, 325);
this.installButton.Name = "installButton";
- this.installButton.Padding = new(12, 0, 12, 0);
- this.installButton.Size = new Size(149, 24);
+ this.installButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0);
+ this.installButton.Size = new System.Drawing.Size(149, 24);
this.installButton.TabIndex = 10004;
this.installButton.Text = "Generate and Install";
this.installButton.UseVisualStyleBackColor = true;
- this.installButton.Click += this.OnInstall;
+ this.installButton.Click += new System.EventHandler(this.OnInstall);
//
// cancelButton
//
- this.cancelButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left)));
+ this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cancelButton.AutoSize = true;
- this.cancelButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
- this.cancelButton.FlatStyle = FlatStyle.System;
- this.cancelButton.Location = new Point(12, 325);
+ this.cancelButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.cancelButton.Location = new System.Drawing.Point(12, 325);
this.cancelButton.Name = "cancelButton";
- this.cancelButton.Padding = new(12, 0, 12, 0);
- this.cancelButton.Size = new Size(81, 24);
+ this.cancelButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0);
+ this.cancelButton.Size = new System.Drawing.Size(81, 24);
this.cancelButton.TabIndex = 10000;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
- this.cancelButton.Click += this.OnCancel;
+ this.cancelButton.Click += new System.EventHandler(this.OnCancel);
//
// programsGroupBox
//
- this.programsGroupBox.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right)));
+ this.programsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.programsGroupBox.Controls.Add(this.koaloaderFlowPanel);
this.programsGroupBox.Controls.Add(this.noneFoundLabel);
this.programsGroupBox.Controls.Add(this.blockedGamesFlowPanel);
this.programsGroupBox.Controls.Add(this.selectionTreeView);
this.programsGroupBox.Controls.Add(this.allCheckBoxLayoutPanel);
- this.programsGroupBox.FlatStyle = FlatStyle.System;
- this.programsGroupBox.Location = new Point(12, 12);
+ this.programsGroupBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.programsGroupBox.Location = new System.Drawing.Point(12, 12);
this.programsGroupBox.Name = "programsGroupBox";
- this.programsGroupBox.Size = new Size(560, 239);
+ this.programsGroupBox.Size = new System.Drawing.Size(560, 209);
this.programsGroupBox.TabIndex = 8;
this.programsGroupBox.TabStop = false;
this.programsGroupBox.Text = "Programs / Games";
//
// koaloaderFlowPanel
//
- this.koaloaderFlowPanel.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right)));
+ this.koaloaderFlowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.koaloaderFlowPanel.AutoSize = true;
- this.koaloaderFlowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ this.koaloaderFlowPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.koaloaderFlowPanel.Controls.Add(this.koaloaderAllCheckBox);
- this.koaloaderFlowPanel.Location = new Point(430, -1);
- this.koaloaderFlowPanel.Margin = new(0);
+ this.koaloaderFlowPanel.Location = new System.Drawing.Point(430, -1);
+ this.koaloaderFlowPanel.Margin = new System.Windows.Forms.Padding(0);
this.koaloaderFlowPanel.Name = "koaloaderFlowPanel";
- this.koaloaderFlowPanel.Size = new Size(73, 19);
+ this.koaloaderFlowPanel.Size = new System.Drawing.Size(73, 19);
this.koaloaderFlowPanel.TabIndex = 10005;
this.koaloaderFlowPanel.WrapContents = false;
//
// koaloaderAllCheckBox
//
- this.koaloaderAllCheckBox.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right)));
+ this.koaloaderAllCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.koaloaderAllCheckBox.Checked = true;
- this.koaloaderAllCheckBox.CheckState = CheckState.Checked;
+ this.koaloaderAllCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.koaloaderAllCheckBox.Enabled = false;
- this.koaloaderAllCheckBox.FlatStyle = FlatStyle.System;
- this.koaloaderAllCheckBox.Location = new Point(2, 0);
- this.koaloaderAllCheckBox.Margin = new(2, 0, 0, 0);
+ this.koaloaderAllCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.koaloaderAllCheckBox.Location = new System.Drawing.Point(2, 0);
+ this.koaloaderAllCheckBox.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0);
this.koaloaderAllCheckBox.Name = "koaloaderAllCheckBox";
- this.koaloaderAllCheckBox.Size = new Size(71, 19);
+ this.koaloaderAllCheckBox.Size = new System.Drawing.Size(71, 19);
this.koaloaderAllCheckBox.TabIndex = 4;
this.koaloaderAllCheckBox.Text = "Koaloader";
- this.koaloaderAllCheckBox.CheckedChanged += this.OnKoaloaderAllCheckBoxChanged;
+ this.koaloaderAllCheckBox.CheckedChanged += new System.EventHandler(this.OnKoaloaderAllCheckBoxChanged);
//
// noneFoundLabel
//
- this.noneFoundLabel.Dock = DockStyle.Fill;
- this.noneFoundLabel.Location = new Point(3, 19);
+ this.noneFoundLabel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.noneFoundLabel.Location = new System.Drawing.Point(3, 19);
this.noneFoundLabel.Name = "noneFoundLabel";
- this.noneFoundLabel.Size = new Size(554, 217);
+ this.noneFoundLabel.Size = new System.Drawing.Size(554, 187);
this.noneFoundLabel.TabIndex = 1002;
this.noneFoundLabel.Text = "No applicable programs nor games were found on your computer!";
this.noneFoundLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -133,46 +139,46 @@ namespace CreamInstaller
//
// blockedGamesFlowPanel
//
- this.blockedGamesFlowPanel.Anchor = AnchorStyles.Top;
+ this.blockedGamesFlowPanel.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.blockedGamesFlowPanel.AutoSize = true;
- this.blockedGamesFlowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ this.blockedGamesFlowPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.blockedGamesFlowPanel.Controls.Add(this.blockedGamesCheckBox);
this.blockedGamesFlowPanel.Controls.Add(this.blockProtectedHelpButton);
- this.blockedGamesFlowPanel.Location = new Point(125, -1);
- this.blockedGamesFlowPanel.Margin = new(0);
+ this.blockedGamesFlowPanel.Location = new System.Drawing.Point(125, -1);
+ this.blockedGamesFlowPanel.Margin = new System.Windows.Forms.Padding(0);
this.blockedGamesFlowPanel.Name = "blockedGamesFlowPanel";
- this.blockedGamesFlowPanel.Size = new Size(162, 20);
+ this.blockedGamesFlowPanel.Size = new System.Drawing.Size(162, 20);
this.blockedGamesFlowPanel.TabIndex = 1005;
this.blockedGamesFlowPanel.WrapContents = false;
//
// blockedGamesCheckBox
//
this.blockedGamesCheckBox.Checked = true;
- this.blockedGamesCheckBox.CheckState = CheckState.Checked;
+ this.blockedGamesCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.blockedGamesCheckBox.Enabled = false;
- this.blockedGamesCheckBox.FlatStyle = FlatStyle.System;
- this.blockedGamesCheckBox.Location = new Point(2, 0);
- this.blockedGamesCheckBox.Margin = new(2, 0, 0, 0);
+ this.blockedGamesCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.blockedGamesCheckBox.Location = new System.Drawing.Point(2, 0);
+ this.blockedGamesCheckBox.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0);
this.blockedGamesCheckBox.Name = "blockedGamesCheckBox";
- this.blockedGamesCheckBox.Size = new Size(140, 20);
+ this.blockedGamesCheckBox.Size = new System.Drawing.Size(140, 20);
this.blockedGamesCheckBox.TabIndex = 1;
this.blockedGamesCheckBox.Text = "Block Protected Games";
this.blockedGamesCheckBox.UseVisualStyleBackColor = true;
- this.blockedGamesCheckBox.CheckedChanged += this.OnBlockProtectedGamesCheckBoxChanged;
+ this.blockedGamesCheckBox.CheckedChanged += new System.EventHandler(this.OnBlockProtectedGamesCheckBoxChanged);
//
// blockProtectedHelpButton
//
this.blockProtectedHelpButton.Enabled = false;
- this.blockProtectedHelpButton.FlatStyle = FlatStyle.System;
- this.blockProtectedHelpButton.Font = new Font("Segoe UI", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.blockProtectedHelpButton.Location = new Point(142, 0);
- this.blockProtectedHelpButton.Margin = new(0, 0, 1, 0);
+ this.blockProtectedHelpButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.blockProtectedHelpButton.Font = new System.Drawing.Font("Segoe UI", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.blockProtectedHelpButton.Location = new System.Drawing.Point(142, 0);
+ this.blockProtectedHelpButton.Margin = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.blockProtectedHelpButton.Name = "blockProtectedHelpButton";
- this.blockProtectedHelpButton.Size = new Size(19, 19);
+ this.blockProtectedHelpButton.Size = new System.Drawing.Size(19, 19);
this.blockProtectedHelpButton.TabIndex = 2;
this.blockProtectedHelpButton.Text = "?";
this.blockProtectedHelpButton.UseVisualStyleBackColor = true;
- this.blockProtectedHelpButton.Click += this.OnBlockProtectedGamesHelpButtonClicked;
+ this.blockProtectedHelpButton.Click += new System.EventHandler(this.OnBlockProtectedGamesHelpButtonClicked);
//
// selectionTreeView
//
@@ -191,121 +197,193 @@ namespace CreamInstaller
//
// allCheckBoxLayoutPanel
//
- this.allCheckBoxLayoutPanel.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right)));
+ this.allCheckBoxLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.allCheckBoxLayoutPanel.AutoSize = true;
- this.allCheckBoxLayoutPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ this.allCheckBoxLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.allCheckBoxLayoutPanel.Controls.Add(this.allCheckBox);
- this.allCheckBoxLayoutPanel.Location = new Point(520, -1);
- this.allCheckBoxLayoutPanel.Margin = new(0);
+ this.allCheckBoxLayoutPanel.Location = new System.Drawing.Point(520, -1);
+ this.allCheckBoxLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
this.allCheckBoxLayoutPanel.Name = "allCheckBoxLayoutPanel";
- this.allCheckBoxLayoutPanel.Size = new Size(34, 19);
+ this.allCheckBoxLayoutPanel.Size = new System.Drawing.Size(34, 19);
this.allCheckBoxLayoutPanel.TabIndex = 1006;
this.allCheckBoxLayoutPanel.WrapContents = false;
//
// allCheckBox
//
- this.allCheckBox.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right)));
+ this.allCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.allCheckBox.Checked = true;
- this.allCheckBox.CheckState = CheckState.Checked;
+ this.allCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.allCheckBox.Enabled = false;
- this.allCheckBox.FlatStyle = FlatStyle.System;
- this.allCheckBox.Location = new Point(2, 0);
- this.allCheckBox.Margin = new(2, 0, 0, 0);
+ this.allCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.allCheckBox.Location = new System.Drawing.Point(2, 0);
+ this.allCheckBox.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0);
this.allCheckBox.Name = "allCheckBox";
- this.allCheckBox.Size = new Size(32, 19);
+ this.allCheckBox.Size = new System.Drawing.Size(32, 19);
this.allCheckBox.TabIndex = 4;
this.allCheckBox.Text = "All";
- this.allCheckBox.CheckedChanged += this.OnAllCheckBoxChanged;
+ this.allCheckBox.CheckedChanged += new System.EventHandler(this.OnAllCheckBoxChanged);
//
// progressBar
//
- this.progressBar.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right)));
- this.progressBar.Location = new Point(12, 296);
+ this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.progressBar.Location = new System.Drawing.Point(12, 266);
this.progressBar.Name = "progressBar";
- this.progressBar.Size = new Size(560, 23);
+ this.progressBar.Size = new System.Drawing.Size(560, 23);
this.progressBar.TabIndex = 9;
//
// progressLabel
//
- this.progressLabel.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right)));
- this.progressLabel.Location = new Point(12, 254);
+ this.progressLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.progressLabel.Location = new System.Drawing.Point(12, 224);
this.progressLabel.Name = "progressLabel";
- this.progressLabel.Size = new Size(560, 15);
+ this.progressLabel.Size = new System.Drawing.Size(560, 15);
this.progressLabel.TabIndex = 10;
this.progressLabel.Text = "Gathering and caching your applicable games and their DLCs . . . 0%";
//
// scanButton
//
- this.scanButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
+ this.scanButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.scanButton.AutoSize = true;
- this.scanButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ this.scanButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.scanButton.Enabled = false;
- this.scanButton.FlatStyle = FlatStyle.System;
- this.scanButton.Location = new Point(235, 325);
+ this.scanButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.scanButton.Location = new System.Drawing.Point(238, 325);
this.scanButton.Name = "scanButton";
- this.scanButton.Padding = new(12, 0, 12, 0);
- this.scanButton.Size = new Size(82, 24);
+ this.scanButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0);
+ this.scanButton.Size = new System.Drawing.Size(82, 24);
this.scanButton.TabIndex = 10002;
this.scanButton.Text = "Rescan";
this.scanButton.UseVisualStyleBackColor = true;
- this.scanButton.Click += this.OnScan;
+ this.scanButton.Click += new System.EventHandler(this.OnScan);
//
// uninstallButton
//
- this.uninstallButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
+ this.uninstallButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.uninstallButton.AutoSize = true;
- this.uninstallButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ this.uninstallButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.uninstallButton.Enabled = false;
- this.uninstallButton.FlatStyle = FlatStyle.System;
- this.uninstallButton.Location = new Point(323, 325);
+ this.uninstallButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.uninstallButton.Location = new System.Drawing.Point(326, 325);
this.uninstallButton.Name = "uninstallButton";
- this.uninstallButton.Padding = new(12, 0, 12, 0);
- this.uninstallButton.Size = new Size(91, 24);
+ this.uninstallButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0);
+ this.uninstallButton.Size = new System.Drawing.Size(91, 24);
this.uninstallButton.TabIndex = 10003;
this.uninstallButton.Text = "Uninstall";
this.uninstallButton.UseVisualStyleBackColor = true;
- this.uninstallButton.Click += this.OnUninstall;
+ this.uninstallButton.Click += new System.EventHandler(this.OnUninstall);
//
// progressLabelGames
//
- this.progressLabelGames.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right)));
- this.progressLabelGames.Font = new Font("Segoe UI", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.progressLabelGames.Location = new Point(12, 269);
+ this.progressLabelGames.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.progressLabelGames.Font = new System.Drawing.Font("Segoe UI", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.progressLabelGames.Location = new System.Drawing.Point(12, 239);
this.progressLabelGames.Name = "progressLabelGames";
- this.progressLabelGames.Size = new Size(560, 12);
+ this.progressLabelGames.Size = new System.Drawing.Size(560, 12);
this.progressLabelGames.TabIndex = 11;
this.progressLabelGames.Text = "Remaining games (2): Game 1, Game 2";
//
// progressLabelDLCs
//
- this.progressLabelDLCs.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right)));
- this.progressLabelDLCs.Font = new Font("Segoe UI", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.progressLabelDLCs.Location = new Point(12, 281);
+ this.progressLabelDLCs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.progressLabelDLCs.Font = new System.Drawing.Font("Segoe UI", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.progressLabelDLCs.Location = new System.Drawing.Point(12, 251);
this.progressLabelDLCs.Name = "progressLabelDLCs";
- this.progressLabelDLCs.Size = new Size(560, 12);
+ this.progressLabelDLCs.Size = new System.Drawing.Size(560, 12);
this.progressLabelDLCs.TabIndex = 12;
this.progressLabelDLCs.Text = "Remaining DLC (2): 123456, 654321";
//
// sortCheckBox
//
- this.sortCheckBox.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left)));
+ this.sortCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.sortCheckBox.AutoSize = true;
- this.sortCheckBox.FlatStyle = FlatStyle.System;
- this.sortCheckBox.Location = new Point(120, 328);
- this.sortCheckBox.Margin = new(3, 0, 0, 0);
+ this.sortCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.sortCheckBox.Location = new System.Drawing.Point(120, 328);
+ this.sortCheckBox.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.sortCheckBox.Name = "sortCheckBox";
- this.sortCheckBox.Size = new Size(104, 20);
+ this.sortCheckBox.Size = new System.Drawing.Size(104, 20);
this.sortCheckBox.TabIndex = 10001;
this.sortCheckBox.Text = "Sort By Name";
- this.sortCheckBox.CheckedChanged += this.OnSortCheckBoxChanged;
+ this.sortCheckBox.CheckedChanged += new System.EventHandler(this.OnSortCheckBoxChanged);
+ //
+ // saveButton
+ //
+ this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.saveButton.AutoSize = true;
+ this.saveButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.saveButton.Enabled = false;
+ this.saveButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.saveButton.Location = new System.Drawing.Point(376, 295);
+ this.saveButton.Name = "saveButton";
+ this.saveButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0);
+ this.saveButton.Size = new System.Drawing.Size(94, 24);
+ this.saveButton.TabIndex = 10005;
+ this.saveButton.Text = "Save DLC";
+ this.saveButton.UseVisualStyleBackColor = true;
+ this.saveButton.Click += new System.EventHandler(this.OnSaveDlc);
+ //
+ // loadButton
+ //
+ this.loadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.loadButton.AutoSize = true;
+ this.loadButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.loadButton.Enabled = false;
+ this.loadButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.loadButton.Location = new System.Drawing.Point(476, 295);
+ this.loadButton.Name = "loadButton";
+ this.loadButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0);
+ this.loadButton.Size = new System.Drawing.Size(96, 24);
+ this.loadButton.TabIndex = 10006;
+ this.loadButton.Text = "Load DLC";
+ this.loadButton.UseVisualStyleBackColor = true;
+ this.loadButton.Click += new System.EventHandler(this.OnLoadDlc);
+ //
+ // resetKoaloaderButton
+ //
+ this.resetKoaloaderButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.resetKoaloaderButton.AutoSize = true;
+ this.resetKoaloaderButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.resetKoaloaderButton.Enabled = false;
+ this.resetKoaloaderButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.resetKoaloaderButton.Location = new System.Drawing.Point(12, 295);
+ this.resetKoaloaderButton.Name = "resetKoaloaderButton";
+ this.resetKoaloaderButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0);
+ this.resetKoaloaderButton.Size = new System.Drawing.Size(129, 24);
+ this.resetKoaloaderButton.TabIndex = 10007;
+ this.resetKoaloaderButton.Text = "Reset Koaloader";
+ this.resetKoaloaderButton.UseVisualStyleBackColor = true;
+ this.resetKoaloaderButton.Click += new System.EventHandler(this.OnResetKoaloader);
+ //
+ // resetButton
+ //
+ this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.resetButton.AutoSize = true;
+ this.resetButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.resetButton.Enabled = false;
+ this.resetButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.resetButton.Location = new System.Drawing.Point(272, 295);
+ this.resetButton.Name = "resetButton";
+ this.resetButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0);
+ this.resetButton.Size = new System.Drawing.Size(98, 24);
+ this.resetButton.TabIndex = 10008;
+ this.resetButton.Text = "Reset DLC";
+ this.resetButton.UseVisualStyleBackColor = true;
+ this.resetButton.Click += new System.EventHandler(this.OnResetDlc);
//
// SelectForm
//
- this.AutoScaleDimensions = new SizeF(7F, 15F);
- this.AutoScaleMode = AutoScaleMode.Font;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
- this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
- this.ClientSize = new Size(584, 361);
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.ClientSize = new System.Drawing.Size(584, 361);
+ this.Controls.Add(this.resetButton);
+ this.Controls.Add(this.resetKoaloaderButton);
+ this.Controls.Add(this.loadButton);
+ this.Controls.Add(this.saveButton);
this.Controls.Add(this.sortCheckBox);
this.Controls.Add(this.progressLabelDLCs);
this.Controls.Add(this.progressLabelGames);
@@ -317,13 +395,13 @@ namespace CreamInstaller
this.Controls.Add(this.installButton);
this.Controls.Add(this.progressLabel);
this.DoubleBuffered = true;
- this.FormBorderStyle = FormBorderStyle.FixedSingle;
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SelectForm";
- this.StartPosition = FormStartPosition.Manual;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "SelectForm";
- this.Load += this.OnLoad;
+ this.Load += new System.EventHandler(this.OnLoad);
this.programsGroupBox.ResumeLayout(false);
this.programsGroupBox.PerformLayout();
this.koaloaderFlowPanel.ResumeLayout(false);
@@ -355,6 +433,10 @@ namespace CreamInstaller
private CheckBox sortCheckBox;
private FlowLayoutPanel koaloaderFlowPanel;
private CheckBox koaloaderAllCheckBox;
+ private Button saveButton;
+ private Button loadButton;
+ private Button resetKoaloaderButton;
+ private Button resetButton;
}
}
diff --git a/CreamInstaller/Forms/SelectForm.cs b/CreamInstaller/Forms/SelectForm.cs
index 09061d9..6614334 100644
--- a/CreamInstaller/Forms/SelectForm.cs
+++ b/CreamInstaller/Forms/SelectForm.cs
@@ -462,6 +462,10 @@ internal partial class SelectForm : CustomForm
installButton.Enabled = false;
uninstallButton.Enabled = installButton.Enabled;
selectionTreeView.Enabled = false;
+ saveButton.Enabled = false;
+ loadButton.Enabled = false;
+ resetButton.Enabled = false;
+ resetKoaloaderButton.Enabled = false;
progressLabel.Text = "Waiting for user to select which programs/games to scan . . .";
ShowProgressBar();
@@ -537,7 +541,8 @@ internal partial class SelectForm : CustomForm
await SteamCMD.Cleanup();
}
- ProgramData.UpdateKoaloaderProxyChoices();
+ ProgramData.UpdateKoaloaderProxyChoices(initial: true);
+ OnLoadDlc(null, null);
HideProgressBar();
selectionTreeView.Enabled = ProgramSelection.All.Any();
@@ -546,6 +551,9 @@ internal partial class SelectForm : CustomForm
noneFoundLabel.Visible = !selectionTreeView.Enabled;
installButton.Enabled = ProgramSelection.AllEnabled.Any();
uninstallButton.Enabled = installButton.Enabled;
+ saveButton.Enabled = CanSaveDlc();
+ loadButton.Enabled = ProgramData.ReadDlcChoices() is not null;
+ resetButton.Enabled = CanResetDlc();
cancelButton.Enabled = false;
scanButton.Enabled = true;
blockedGamesCheckBox.Enabled = true;
@@ -561,10 +569,12 @@ internal partial class SelectForm : CustomForm
SyncNodeAncestors(node);
SyncNodeDescendants(node);
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
- allCheckBox.Checked = TreeNodes.TrueForAll(treeNode => treeNode.Checked);
+ allCheckBox.Checked = TreeNodes.TrueForAll(node => node.Text == "Unknown" || node.Checked);
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
installButton.Enabled = ProgramSelection.AllEnabled.Any();
uninstallButton.Enabled = installButton.Enabled;
+ saveButton.Enabled = CanSaveDlc();
+ resetButton.Enabled = CanResetDlc();
}
private static void SyncNodeAncestors(TreeNode node)
@@ -893,6 +903,60 @@ internal partial class SelectForm : CustomForm
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
}
+ private bool AreSelectionsDefault()
+ {
+ foreach (TreeNode node in TreeNodes)
+ if (node.Parent is not null && node.Tag is Platform && (node.Text == "Unknown" ? node.Checked : !node.Checked))
+ return false;
+ return true;
+ }
+
+ private bool CanSaveDlc() => installButton.Enabled && (ProgramData.ReadDlcChoices() is not null || !AreSelectionsDefault());
+
+ private void OnSaveDlc(object sender, EventArgs e)
+ {
+ List<(Platform platform, string gameId, string dlcId)> choices = ProgramData.ReadDlcChoices() ?? new();
+ foreach (TreeNode node in TreeNodes)
+ if (node.Parent is TreeNode parent && node.Tag is Platform platform)
+ {
+ if (node.Text == "Unknown" ? node.Checked : !node.Checked)
+ choices.Add((platform, node.Parent.Name, node.Name));
+ else
+ choices.RemoveAll(n => n.platform == platform && n.gameId == parent.Name && n.dlcId == node.Name);
+ }
+ choices = choices.Distinct().ToList();
+ ProgramData.WriteDlcChoices(choices);
+ loadButton.Enabled = ProgramData.ReadDlcChoices() is not null;
+ saveButton.Enabled = CanSaveDlc();
+ }
+
+ private void OnLoadDlc(object sender, EventArgs e)
+ {
+ List<(Platform platform, string gameId, string dlcId)> choices = ProgramData.ReadDlcChoices();
+ if (choices is null) return;
+ foreach (TreeNode node in TreeNodes)
+ if (node.Parent is TreeNode parent && node.Tag is Platform platform)
+ {
+ node.Checked = choices.Any(choice => choice.platform == platform && choice.gameId == parent.Name && choice.dlcId == node.Name)
+ ? node.Text == "Unknown"
+ : node.Text != "Unknown";
+ OnTreeViewNodeCheckedChanged(null, new(node, TreeViewAction.ByMouse));
+ }
+ }
+
+ private bool CanResetDlc() => !AreSelectionsDefault();
+
+ private void OnResetDlc(object sender, EventArgs e)
+ {
+ foreach (TreeNode node in TreeNodes)
+ if (node.Parent is not null && node.Tag is Platform)
+ {
+ node.Checked = node.Text != "Unknown";
+ OnTreeViewNodeCheckedChanged(null, new(node, TreeViewAction.ByMouse));
+ }
+ resetButton.Enabled = CanResetDlc();
+ }
+
internal CheckBox KoaloaderAllCheckBox() => koaloaderAllCheckBox;
internal void OnKoaloaderAllCheckBoxChanged(object sender, EventArgs e)
{
@@ -911,6 +975,16 @@ internal partial class SelectForm : CustomForm
koaloaderAllCheckBox.CheckedChanged += OnKoaloaderAllCheckBoxChanged;
}
+ private static bool CanResetKoaloader() => File.Exists(ProgramData.KoaloaderProxyChoicesPath);
+
+ private void OnResetKoaloader(object sender, EventArgs e) => ProgramData.ResetKoaloaderProxyChoices();
+
+ internal void OnKoaloaderProxiesChanged()
+ {
+ selectionTreeView.Invalidate();
+ resetKoaloaderButton.Enabled = CanResetKoaloader();
+ }
+
private void OnBlockProtectedGamesCheckBoxChanged(object sender, EventArgs e)
{
Program.BlockProtectedGames = blockedGamesCheckBox.Checked;
diff --git a/CreamInstaller/ProgramSelection.cs b/CreamInstaller/ProgramSelection.cs
index 04e2c32..48439a0 100644
--- a/CreamInstaller/ProgramSelection.cs
+++ b/CreamInstaller/ProgramSelection.cs
@@ -30,6 +30,7 @@ internal class ProgramSelection
{
internal bool Enabled;
internal bool Koaloader;
+ internal const string DefaultKoaloaderProxy = "version";
internal string KoaloaderProxy;
internal Platform Platform;
diff --git a/CreamInstaller/Resources/Koaloader.cs b/CreamInstaller/Resources/Koaloader.cs
index 611a332..1395bef 100644
--- a/CreamInstaller/Resources/Koaloader.cs
+++ b/CreamInstaller/Resources/Koaloader.cs
@@ -157,7 +157,8 @@ internal static class Koaloader
internal static async Task Install(string directory, BinaryType binaryType, ProgramSelection selection, InstallForm installForm = null, bool generateConfig = true) => await Task.Run(() =>
{
directory.GetKoaloaderComponents(out List proxies, out string config);
- string path = directory + @"\" + selection.KoaloaderProxy + ".dll";
+ string proxy = selection.KoaloaderProxy ?? ProgramSelection.DefaultKoaloaderProxy;
+ string path = directory + @"\" + proxy + ".dll";
foreach (string _path in proxies.Where(p => p != path && File.Exists(p) && p.IsResourceFile(ResourceIdentifier.Koaloader)))
{
File.Delete(_path);
@@ -165,8 +166,8 @@ internal static class Koaloader
installForm.UpdateUser($"Deleted Koaloader: {Path.GetFileName(_path)}", LogTextBox.Action, info: false);
}
if (File.Exists(path) && !path.IsResourceFile(ResourceIdentifier.Koaloader))
- throw new CustomMessageException("A non-Koaloader DLL named " + selection.KoaloaderProxy + ".dll already exists in this directory!");
- path.WriteProxy(selection.KoaloaderProxy, binaryType);
+ throw new CustomMessageException("A non-Koaloader DLL named " + proxy + ".dll already exists in this directory!");
+ path.WriteProxy(proxy, binaryType);
if (installForm is not null)
installForm.UpdateUser($"Wrote {(binaryType == BinaryType.BIT32 ? "32-bit" : "64-bit")} Koaloader: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
bool bit32 = false, bit64 = false;
diff --git a/CreamInstaller/Utility/ProgramData.cs b/CreamInstaller/Utility/ProgramData.cs
index 6f785de..482ee25 100644
--- a/CreamInstaller/Utility/ProgramData.cs
+++ b/CreamInstaller/Utility/ProgramData.cs
@@ -8,6 +8,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Forms;
namespace CreamInstaller.Utility;
@@ -23,9 +24,9 @@ internal static class ProgramData
internal static readonly string CooldownPath = DirectoryPath + @"\cooldown";
- internal static readonly string OldChoicesPath = DirectoryPath + @"\choices.txt";
- internal static readonly string ChoicesPath = DirectoryPath + @"\choices.json";
-
+ internal static readonly string OldProgramChoicesPath = DirectoryPath + @"\choices.txt";
+ internal static readonly string ProgramChoicesPath = DirectoryPath + @"\choices.json";
+ internal static readonly string DlcChoicesPath = DirectoryPath + @"\dlc.json";
internal static readonly string KoaloaderProxyChoicesPath = DirectoryPath + @"\proxies.json";
internal static async Task Setup() => await Task.Run(() =>
@@ -44,8 +45,8 @@ internal static class ProgramData
}
if (!Directory.Exists(CooldownPath))
_ = Directory.CreateDirectory(CooldownPath);
- if (File.Exists(OldChoicesPath))
- File.Delete(OldChoicesPath);
+ if (File.Exists(OldProgramChoicesPath))
+ File.Delete(OldProgramChoicesPath);
});
internal static bool CheckCooldown(string identifier, int cooldown)
@@ -86,12 +87,12 @@ internal static class ProgramData
catch { }
}
- internal static List<(Platform platform, string id)> ReadChoices()
+ internal static List<(Platform platform, string id)> ReadProgramChoices()
{
- if (!File.Exists(ChoicesPath)) return null;
+ if (!File.Exists(ProgramChoicesPath)) return null;
try
{
- return JsonConvert.DeserializeObject(File.ReadAllText(ChoicesPath),
+ return JsonConvert.DeserializeObject(File.ReadAllText(ProgramChoicesPath),
typeof(List<(Platform platform, string id)>)) as List<(Platform platform, string id)>;
}
catch
@@ -99,11 +100,39 @@ internal static class ProgramData
return new();
}
}
- internal static void WriteChoices(List<(Platform platform, string id)> choices)
+ internal static void WriteProgramChoices(List<(Platform platform, string id)> choices)
{
try
{
- File.WriteAllText(ChoicesPath, JsonConvert.SerializeObject(choices));
+ if (choices is null || !choices.Any())
+ File.Delete(ProgramChoicesPath);
+ else
+ File.WriteAllText(ProgramChoicesPath, JsonConvert.SerializeObject(choices));
+ }
+ catch { }
+ }
+
+ internal static List<(Platform platform, string gameId, string dlcId)> ReadDlcChoices()
+ {
+ if (!File.Exists(DlcChoicesPath)) return null;
+ try
+ {
+ return JsonConvert.DeserializeObject(File.ReadAllText(DlcChoicesPath),
+ typeof(List<(Platform platform, string gameId, string dlcId)>)) as List<(Platform platform, string gameId, string dlcId)>;
+ }
+ catch
+ {
+ return new();
+ }
+ }
+ internal static void WriteDlcChoices(List<(Platform platform, string gameId, string dlcId)> choices)
+ {
+ try
+ {
+ if (choices is null || !choices.Any())
+ File.Delete(DlcChoicesPath);
+ else
+ File.WriteAllText(DlcChoicesPath, JsonConvert.SerializeObject(choices));
}
catch { }
}
@@ -126,40 +155,46 @@ internal static class ProgramData
{
try
{
- File.WriteAllText(KoaloaderProxyChoicesPath, JsonConvert.SerializeObject(choices));
+ if (choices is null || !choices.Any())
+ File.Delete(KoaloaderProxyChoicesPath);
+ else
+ File.WriteAllText(KoaloaderProxyChoicesPath, JsonConvert.SerializeObject(choices));
}
catch { }
}
- internal static void UpdateKoaloaderProxyChoices()
+ internal static void UpdateKoaloaderProxyChoices(bool initial = false)
{
- string defaultProxy = "version";
List<(Platform platform, string id, string proxy)> choices = ReadKoaloaderProxyChoices() ?? new();
- foreach ((Platform platform, string id, string proxy) choice in choices.ToList())
- if (ProgramSelection.FromPlatformId(choice.platform, choice.id) is ProgramSelection selection)
+ if (!initial)
+ foreach (ProgramSelection selection in ProgramSelection.AllSafe)
{
- string proxy = choice.proxy;
- if (proxy.Contains('.')) // convert pre-v4.1.0.0 choices
- proxy.GetProxyInfoFromIdentifier(out proxy, out _);
- if (selection.KoaloaderProxy is null)
- selection.KoaloaderProxy = proxy;
- else if (selection.KoaloaderProxy != proxy && choices.Remove(choice))
+ _ = choices.RemoveAll(c => c.platform == selection.Platform && c.id == selection.Id);
+ if (selection.KoaloaderProxy is not null and not ProgramSelection.DefaultKoaloaderProxy)
choices.Add((selection.Platform, selection.Id, selection.KoaloaderProxy));
}
- foreach (ProgramSelection selection in ProgramSelection.AllSafe)
- if (selection.KoaloaderProxy is null)
- {
- selection.KoaloaderProxy = defaultProxy;
- choices.Add((selection.Platform, selection.Id, selection.KoaloaderProxy));
- }
- if (choices.Any())
- WriteKoaloaderProxyChoices(choices);
+ foreach ((Platform platform, string id, string proxy) choice in choices.ToList())
+ {
+ string proxy = choice.proxy;
+ if (proxy is not null && proxy.Contains('.')) // convert pre-v4.1.0.0 choices
+ proxy.GetProxyInfoFromIdentifier(out proxy, out _);
+ if (choice.proxy != proxy && choices.Remove(choice)) // convert pre-v4.1.0.0 choices
+ choices.Add((choice.platform, choice.id, proxy));
+ if (proxy is null or ProgramSelection.DefaultKoaloaderProxy)
+ _ = choices.RemoveAll(c => c.platform == choice.platform && c.id == choice.id);
+ else if (ProgramSelection.FromPlatformId(choice.platform, choice.id) is ProgramSelection selection)
+ selection.KoaloaderProxy = proxy;
+ }
+ WriteKoaloaderProxyChoices(choices);
+ foreach (Form form in Application.OpenForms)
+ if (form is SelectForm selectForm)
+ selectForm.OnKoaloaderProxiesChanged();
}
internal static void ResetKoaloaderProxyChoices()
{
- if (File.Exists(KoaloaderProxyChoicesPath))
- File.Delete(KoaloaderProxyChoicesPath);
+ foreach (ProgramSelection selection in ProgramSelection.AllSafe)
+ selection.KoaloaderProxy = null;
UpdateKoaloaderProxyChoices();
}
}