Consolidate save load reset functionalities into one button each & fix DLC selection saving
This commit is contained in:
parent
a8bfc73d6a
commit
abf4172787
4 changed files with 183 additions and 247 deletions
63
CreamInstaller/Forms/SelectForm.Designer.cs
generated
63
CreamInstaller/Forms/SelectForm.Designer.cs
generated
|
@ -39,10 +39,7 @@ namespace CreamInstaller.Forms
|
||||||
sortCheckBox = new CheckBox();
|
sortCheckBox = new CheckBox();
|
||||||
saveButton = new Button();
|
saveButton = new Button();
|
||||||
loadButton = new Button();
|
loadButton = new Button();
|
||||||
resetProxyButton = new Button();
|
|
||||||
resetButton = new Button();
|
resetButton = new Button();
|
||||||
saveProxyButton = new Button();
|
|
||||||
loadProxyButton = new Button();
|
|
||||||
selectionTreeView = new CustomTreeView();
|
selectionTreeView = new CustomTreeView();
|
||||||
programsGroupBox.SuspendLayout();
|
programsGroupBox.SuspendLayout();
|
||||||
proxyFlowPanel.SuspendLayout();
|
proxyFlowPanel.SuspendLayout();
|
||||||
|
@ -305,9 +302,9 @@ namespace CreamInstaller.Forms
|
||||||
saveButton.Name = "saveButton";
|
saveButton.Name = "saveButton";
|
||||||
saveButton.Size = new System.Drawing.Size(66, 25);
|
saveButton.Size = new System.Drawing.Size(66, 25);
|
||||||
saveButton.TabIndex = 10006;
|
saveButton.TabIndex = 10006;
|
||||||
saveButton.Text = "Save DLC";
|
saveButton.Text = "Save";
|
||||||
saveButton.UseVisualStyleBackColor = true;
|
saveButton.UseVisualStyleBackColor = true;
|
||||||
saveButton.Click += OnSaveDlc;
|
saveButton.Click += OnSaveSelections;
|
||||||
//
|
//
|
||||||
// loadButton
|
// loadButton
|
||||||
//
|
//
|
||||||
|
@ -319,23 +316,9 @@ namespace CreamInstaller.Forms
|
||||||
loadButton.Name = "loadButton";
|
loadButton.Name = "loadButton";
|
||||||
loadButton.Size = new System.Drawing.Size(68, 25);
|
loadButton.Size = new System.Drawing.Size(68, 25);
|
||||||
loadButton.TabIndex = 10005;
|
loadButton.TabIndex = 10005;
|
||||||
loadButton.Text = "Load DLC";
|
loadButton.Text = "Load";
|
||||||
loadButton.UseVisualStyleBackColor = true;
|
loadButton.UseVisualStyleBackColor = true;
|
||||||
loadButton.Click += OnLoadDlc;
|
loadButton.Click += OnLoadSelections;
|
||||||
//
|
|
||||||
// resetProxyButton
|
|
||||||
//
|
|
||||||
resetProxyButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
resetProxyButton.AutoSize = true;
|
|
||||||
resetProxyButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
resetProxyButton.Enabled = false;
|
|
||||||
resetProxyButton.Location = new System.Drawing.Point(12, 295);
|
|
||||||
resetProxyButton.Name = "resetProxyButton";
|
|
||||||
resetProxyButton.Size = new System.Drawing.Size(101, 25);
|
|
||||||
resetProxyButton.TabIndex = 10010;
|
|
||||||
resetProxyButton.Text = "Reset Proxy";
|
|
||||||
resetProxyButton.UseVisualStyleBackColor = true;
|
|
||||||
resetProxyButton.Click += OnResetProxy;
|
|
||||||
//
|
//
|
||||||
// resetButton
|
// resetButton
|
||||||
//
|
//
|
||||||
|
@ -347,37 +330,9 @@ namespace CreamInstaller.Forms
|
||||||
resetButton.Name = "resetButton";
|
resetButton.Name = "resetButton";
|
||||||
resetButton.Size = new System.Drawing.Size(70, 25);
|
resetButton.Size = new System.Drawing.Size(70, 25);
|
||||||
resetButton.TabIndex = 10007;
|
resetButton.TabIndex = 10007;
|
||||||
resetButton.Text = "Reset DLC";
|
resetButton.Text = "Reset";
|
||||||
resetButton.UseVisualStyleBackColor = true;
|
resetButton.UseVisualStyleBackColor = true;
|
||||||
resetButton.Click += OnResetDlc;
|
resetButton.Click += OnResetSelections;
|
||||||
//
|
|
||||||
// saveProxyButton
|
|
||||||
//
|
|
||||||
saveProxyButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
saveProxyButton.AutoSize = true;
|
|
||||||
saveProxyButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
saveProxyButton.Enabled = false;
|
|
||||||
saveProxyButton.Location = new System.Drawing.Point(119, 295);
|
|
||||||
saveProxyButton.Name = "saveProxyButton";
|
|
||||||
saveProxyButton.Size = new System.Drawing.Size(97, 25);
|
|
||||||
saveProxyButton.TabIndex = 10009;
|
|
||||||
saveProxyButton.Text = "Save Proxy";
|
|
||||||
saveProxyButton.UseVisualStyleBackColor = true;
|
|
||||||
saveProxyButton.Click += OnSaveProxy;
|
|
||||||
//
|
|
||||||
// loadProxyButton
|
|
||||||
//
|
|
||||||
loadProxyButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
loadProxyButton.AutoSize = true;
|
|
||||||
loadProxyButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
loadProxyButton.Enabled = false;
|
|
||||||
loadProxyButton.Location = new System.Drawing.Point(222, 295);
|
|
||||||
loadProxyButton.Name = "loadProxyButton";
|
|
||||||
loadProxyButton.Size = new System.Drawing.Size(99, 25);
|
|
||||||
loadProxyButton.TabIndex = 10008;
|
|
||||||
loadProxyButton.Text = "Load Proxy";
|
|
||||||
loadProxyButton.UseVisualStyleBackColor = true;
|
|
||||||
loadProxyButton.Click += OnLoadProxy;
|
|
||||||
//
|
//
|
||||||
// SelectForm
|
// SelectForm
|
||||||
//
|
//
|
||||||
|
@ -386,10 +341,7 @@ namespace CreamInstaller.Forms
|
||||||
AutoSize = true;
|
AutoSize = true;
|
||||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
ClientSize = new System.Drawing.Size(584, 361);
|
ClientSize = new System.Drawing.Size(584, 361);
|
||||||
Controls.Add(loadProxyButton);
|
|
||||||
Controls.Add(saveProxyButton);
|
|
||||||
Controls.Add(resetButton);
|
Controls.Add(resetButton);
|
||||||
Controls.Add(resetProxyButton);
|
|
||||||
Controls.Add(loadButton);
|
Controls.Add(loadButton);
|
||||||
Controls.Add(saveButton);
|
Controls.Add(saveButton);
|
||||||
Controls.Add(sortCheckBox);
|
Controls.Add(sortCheckBox);
|
||||||
|
@ -445,10 +397,7 @@ namespace CreamInstaller.Forms
|
||||||
internal CheckBox proxyAllCheckBox;
|
internal CheckBox proxyAllCheckBox;
|
||||||
private Button saveButton;
|
private Button saveButton;
|
||||||
private Button loadButton;
|
private Button loadButton;
|
||||||
private Button resetProxyButton;
|
|
||||||
private Button resetButton;
|
private Button resetButton;
|
||||||
private Button saveProxyButton;
|
|
||||||
private Button loadProxyButton;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ using CreamInstaller.Platforms.Steam;
|
||||||
using CreamInstaller.Platforms.Ubisoft;
|
using CreamInstaller.Platforms.Ubisoft;
|
||||||
using CreamInstaller.Resources;
|
using CreamInstaller.Resources;
|
||||||
using CreamInstaller.Utility;
|
using CreamInstaller.Utility;
|
||||||
using Gameloop.Vdf.Linq;
|
|
||||||
using static CreamInstaller.Resources.Resources;
|
using static CreamInstaller.Resources.Resources;
|
||||||
|
|
||||||
namespace CreamInstaller.Forms;
|
namespace CreamInstaller.Forms;
|
||||||
|
@ -563,9 +562,6 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
saveButton.Enabled = false;
|
saveButton.Enabled = false;
|
||||||
loadButton.Enabled = false;
|
loadButton.Enabled = false;
|
||||||
resetButton.Enabled = false;
|
resetButton.Enabled = false;
|
||||||
saveProxyButton.Enabled = false;
|
|
||||||
loadProxyButton.Enabled = false;
|
|
||||||
resetProxyButton.Enabled = false;
|
|
||||||
progressLabel.Text = "Waiting for user to select which programs/games to scan . . .";
|
progressLabel.Text = "Waiting for user to select which programs/games to scan . . .";
|
||||||
ShowProgressBar();
|
ShowProgressBar();
|
||||||
await ProgramData.Setup(this);
|
await ProgramData.Setup(this);
|
||||||
|
@ -686,8 +682,7 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
await SteamCMD.Cleanup();
|
await SteamCMD.Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
OnLoadDlc(null, null);
|
OnLoadSelections(null, null);
|
||||||
OnLoadProxy(null, null);
|
|
||||||
HideProgressBar();
|
HideProgressBar();
|
||||||
selectionTreeView.Enabled = !Selection.All.IsEmpty;
|
selectionTreeView.Enabled = !Selection.All.IsEmpty;
|
||||||
allCheckBox.Enabled = selectionTreeView.Enabled;
|
allCheckBox.Enabled = selectionTreeView.Enabled;
|
||||||
|
@ -695,12 +690,9 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
noneFoundLabel.Visible = !selectionTreeView.Enabled;
|
noneFoundLabel.Visible = !selectionTreeView.Enabled;
|
||||||
installButton.Enabled = Selection.AllEnabled.Any();
|
installButton.Enabled = Selection.AllEnabled.Any();
|
||||||
uninstallButton.Enabled = installButton.Enabled;
|
uninstallButton.Enabled = installButton.Enabled;
|
||||||
saveButton.Enabled = CanSaveDlc();
|
saveButton.Enabled = CanSaveSelections();
|
||||||
loadButton.Enabled = CanLoadDlc();
|
loadButton.Enabled = CanLoadSelections();
|
||||||
resetButton.Enabled = CanResetDlc();
|
resetButton.Enabled = CanResetSelections();
|
||||||
saveProxyButton.Enabled = CanSaveProxy();
|
|
||||||
loadProxyButton.Enabled = CanLoadProxy();
|
|
||||||
resetProxyButton.Enabled = CanResetProxy();
|
|
||||||
cancelButton.Enabled = false;
|
cancelButton.Enabled = false;
|
||||||
scanButton.Enabled = true;
|
scanButton.Enabled = true;
|
||||||
blockedGamesCheckBox.Enabled = true;
|
blockedGamesCheckBox.Enabled = true;
|
||||||
|
@ -722,8 +714,10 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
|
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
|
||||||
installButton.Enabled = Selection.AllEnabled.Any();
|
installButton.Enabled = Selection.AllEnabled.Any();
|
||||||
uninstallButton.Enabled = installButton.Enabled;
|
uninstallButton.Enabled = installButton.Enabled;
|
||||||
saveButton.Enabled = CanSaveDlc();
|
if (sender is "OnLoadSelections" or "OnResetSelections")
|
||||||
resetButton.Enabled = CanResetDlc();
|
return;
|
||||||
|
saveButton.Enabled = CanSaveSelections();
|
||||||
|
resetButton.Enabled = CanResetSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SyncNodeAncestors(TreeNode node)
|
private static void SyncNodeAncestors(TreeNode node)
|
||||||
|
@ -1029,7 +1023,7 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
foreach (Selection selection in Selection.All.Keys.Where(s => s.Enabled != shouldEnable))
|
foreach (Selection selection in Selection.All.Keys.Where(s => s.Enabled != shouldEnable))
|
||||||
{
|
{
|
||||||
selection.Enabled = shouldEnable;
|
selection.Enabled = shouldEnable;
|
||||||
OnTreeViewNodeCheckedChanged(null, new(selection.TreeNode, TreeViewAction.ByMouse));
|
OnTreeViewNodeCheckedChanged("OnAllCheckBoxChanged", new(selection.TreeNode, TreeViewAction.ByMouse));
|
||||||
}
|
}
|
||||||
|
|
||||||
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
|
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
|
||||||
|
@ -1046,7 +1040,7 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
proxyAllCheckBox.CheckedChanged -= OnProxyAllCheckBoxChanged;
|
proxyAllCheckBox.CheckedChanged -= OnProxyAllCheckBoxChanged;
|
||||||
proxyAllCheckBox.Checked = shouldEnable;
|
proxyAllCheckBox.Checked = shouldEnable;
|
||||||
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
|
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
|
||||||
resetProxyButton.Enabled = CanResetProxy();
|
resetButton.Enabled = CanResetSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AreSelectionsDefault()
|
private bool AreSelectionsDefault()
|
||||||
|
@ -1054,96 +1048,79 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
=> node.Parent is null || node.Tag is not Platform and not DLCType ||
|
=> node.Parent is null || node.Tag is not Platform and not DLCType ||
|
||||||
(node.Text == "Unknown" ? !node.Checked : node.Checked));
|
(node.Text == "Unknown" ? !node.Checked : node.Checked));
|
||||||
|
|
||||||
|
private static bool AreProxySelectionsDefault() => Selection.All.Keys.All(selection => !selection.UseProxy);
|
||||||
|
|
||||||
private bool CanSaveDlc() =>
|
private bool CanSaveDlc() =>
|
||||||
installButton.Enabled && (ProgramData.ReadDlcChoices().Any() || !AreSelectionsDefault());
|
installButton.Enabled && (ProgramData.ReadDlcChoices().Any() || !AreSelectionsDefault());
|
||||||
|
|
||||||
private void OnSaveDlc(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
List<(Platform platform, string gameId, string dlcId)> choices = ProgramData.ReadDlcChoices().ToList();
|
|
||||||
foreach (SelectionDLC dlc in SelectionDLC.All.Keys)
|
|
||||||
if ((dlc.Name == "Unknown" ? dlc.Enabled : !dlc.Enabled)
|
|
||||||
&& !choices.Any(c =>
|
|
||||||
c.platform == dlc.Selection.Platform && c.gameId == dlc.Selection.Id && c.dlcId == dlc.Id))
|
|
||||||
choices.Add((dlc.Selection.Platform, dlc.Selection.Id, dlc.Id));
|
|
||||||
else
|
|
||||||
_ = choices.RemoveAll(n =>
|
|
||||||
n.platform == dlc.Selection.Platform && n.gameId == dlc.Selection.Id && n.dlcId == dlc.Id);
|
|
||||||
ProgramData.WriteDlcChoices(choices);
|
|
||||||
loadButton.Enabled = CanLoadDlc();
|
|
||||||
saveButton.Enabled = CanSaveDlc();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool CanLoadDlc() => ProgramData.ReadDlcChoices().Any();
|
|
||||||
|
|
||||||
private void OnLoadDlc(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
List<(Platform platform, string gameId, string dlcId)> choices = ProgramData.ReadDlcChoices().ToList();
|
|
||||||
foreach (SelectionDLC dlc in SelectionDLC.All.Keys)
|
|
||||||
{
|
|
||||||
dlc.Enabled = choices.Any(c =>
|
|
||||||
c.platform == dlc.Selection?.Platform && c.gameId == dlc.Selection?.Id && c.dlcId == dlc.Id)
|
|
||||||
? dlc.Name == "Unknown"
|
|
||||||
: dlc.Name != "Unknown";
|
|
||||||
OnTreeViewNodeCheckedChanged(null, new(dlc.TreeNode, TreeViewAction.ByMouse));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CanResetDlc() => !AreSelectionsDefault();
|
|
||||||
|
|
||||||
private void OnResetDlc(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
foreach (SelectionDLC dlc in SelectionDLC.All.Keys)
|
|
||||||
{
|
|
||||||
dlc.Enabled = dlc.Name != "Unknown";
|
|
||||||
OnTreeViewNodeCheckedChanged(null, new(dlc.TreeNode, TreeViewAction.ByMouse));
|
|
||||||
}
|
|
||||||
|
|
||||||
resetButton.Enabled = CanResetDlc();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool AreProxySelectionsDefault() =>
|
|
||||||
Selection.All.Keys.All(selection => !selection.UseProxy && selection.Proxy is null);
|
|
||||||
|
|
||||||
private static bool CanSaveProxy() =>
|
private static bool CanSaveProxy() =>
|
||||||
ProgramData.ReadProxyChoices().Any() || !AreProxySelectionsDefault();
|
ProgramData.ReadProxyChoices().Any() || !AreProxySelectionsDefault();
|
||||||
|
|
||||||
private void OnSaveProxy(object sender, EventArgs e)
|
private bool CanSaveSelections() => CanSaveDlc() || CanSaveProxy();
|
||||||
|
|
||||||
|
private void OnSaveSelections(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
List<(Platform platform, string id, string proxy, bool enabled)> choices =
|
List<(Platform platform, string gameId, string dlcId)> dlcChoices = ProgramData.ReadDlcChoices().ToList();
|
||||||
|
foreach (SelectionDLC dlc in SelectionDLC.All.Keys)
|
||||||
|
{
|
||||||
|
_ = dlcChoices.RemoveAll(n =>
|
||||||
|
n.platform == dlc.Selection.Platform && n.gameId == dlc.Selection.Id && n.dlcId == dlc.Id);
|
||||||
|
if (dlc.Name == "Unknown" ? dlc.Enabled : !dlc.Enabled)
|
||||||
|
dlcChoices.Add((dlc.Selection.Platform, dlc.Selection.Id, dlc.Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgramData.WriteDlcChoices(dlcChoices);
|
||||||
|
|
||||||
|
List<(Platform platform, string id, string proxy, bool enabled)> proxyChoices =
|
||||||
ProgramData.ReadProxyChoices().ToList();
|
ProgramData.ReadProxyChoices().ToList();
|
||||||
foreach (Selection selection in Selection.All.Keys)
|
foreach (Selection selection in Selection.All.Keys)
|
||||||
{
|
{
|
||||||
_ = choices.RemoveAll(c => c.platform == selection.Platform && c.id == selection.Id);
|
_ = proxyChoices.RemoveAll(c => c.platform == selection.Platform && c.id == selection.Id);
|
||||||
if (selection.Proxy is not null and not Selection.DefaultProxy || selection.UseProxy)
|
if (selection.UseProxy)
|
||||||
choices.Add((selection.Platform, selection.Id,
|
proxyChoices.Add((selection.Platform, selection.Id,
|
||||||
selection.Proxy == Selection.DefaultProxy ? null : selection.Proxy,
|
selection.Proxy == Selection.DefaultProxy ? null : selection.Proxy,
|
||||||
selection.UseProxy));
|
selection.UseProxy));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgramData.WriteProxyChoices(choices);
|
ProgramData.WriteProxyChoices(proxyChoices);
|
||||||
saveProxyButton.Enabled = CanSaveProxy();
|
|
||||||
loadProxyButton.Enabled = CanLoadProxy();
|
loadButton.Enabled = CanLoadSelections();
|
||||||
|
saveButton.Enabled = CanSaveSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool CanLoadDlc() => ProgramData.ReadDlcChoices().Any();
|
||||||
|
|
||||||
private static bool CanLoadProxy() => ProgramData.ReadProxyChoices().Any();
|
private static bool CanLoadProxy() => ProgramData.ReadProxyChoices().Any();
|
||||||
|
|
||||||
private void OnLoadProxy(object sender, EventArgs e)
|
private bool CanLoadSelections() => CanLoadDlc() || CanLoadProxy();
|
||||||
|
|
||||||
|
private void OnLoadSelections(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
List<(Platform platform, string id, string proxy, bool enabled)> choices =
|
List<(Platform platform, string gameId, string dlcId)> dlcChoices = ProgramData.ReadDlcChoices().ToList();
|
||||||
|
foreach (SelectionDLC dlc in SelectionDLC.All.Keys)
|
||||||
|
{
|
||||||
|
dlc.Enabled = dlcChoices.Any(c =>
|
||||||
|
c.platform == dlc.Selection?.Platform && c.gameId == dlc.Selection?.Id && c.dlcId == dlc.Id)
|
||||||
|
? dlc.Name == "Unknown"
|
||||||
|
: dlc.Name != "Unknown";
|
||||||
|
OnTreeViewNodeCheckedChanged("OnLoadSelections", new(dlc.TreeNode, TreeViewAction.ByMouse));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<(Platform platform, string id, string proxy, bool enabled)> proxyChoices =
|
||||||
ProgramData.ReadProxyChoices().ToList();
|
ProgramData.ReadProxyChoices().ToList();
|
||||||
foreach (Selection selection in Selection.All.Keys)
|
foreach (Selection selection in Selection.All.Keys)
|
||||||
if (choices.Any(c => c.platform == selection.Platform && c.id == selection.Id))
|
if (proxyChoices.Any(c => c.platform == selection.Platform && c.id == selection.Id))
|
||||||
{
|
{
|
||||||
(Platform platform, string id, string proxy, bool enabled)
|
(Platform platform, string id, string proxy, bool enabled)
|
||||||
choice = choices.First(c => c.platform == selection.Platform && c.id == selection.Id);
|
choice = proxyChoices.First(c => c.platform == selection.Platform && c.id == selection.Id);
|
||||||
(Platform platform, string id, string proxy, bool enabled) = choice;
|
(Platform platform, string id, string proxy, bool enabled) = choice;
|
||||||
string currentProxy = proxy;
|
string currentProxy = proxy;
|
||||||
if (proxy is not null && proxy.Contains('.')) // convert pre-v4.1.0.0 choices
|
if (proxy is not null && proxy.Contains('.')) // convert pre-v4.1.0.0 choices
|
||||||
proxy.GetProxyInfoFromIdentifier(out currentProxy, out _);
|
proxy.GetProxyInfoFromIdentifier(out currentProxy, out _);
|
||||||
if (proxy != currentProxy && choices.Remove(choice)) // convert pre-v4.1.0.0 choices
|
if (proxy != currentProxy && proxyChoices.Remove(choice)) // convert pre-v4.1.0.0 choices
|
||||||
choices.Add((platform, id, currentProxy, enabled));
|
proxyChoices.Add((platform, id, currentProxy, enabled));
|
||||||
if (currentProxy is null or Selection.DefaultProxy && !enabled)
|
if (currentProxy is null or Selection.DefaultProxy && !enabled)
|
||||||
_ = choices.RemoveAll(c => c.platform == platform && c.id == id);
|
_ = proxyChoices.RemoveAll(c => c.platform == platform && c.id == id);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
selection.UseProxy = enabled;
|
selection.UseProxy = enabled;
|
||||||
|
@ -1156,15 +1133,26 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
selection.Proxy = null;
|
selection.Proxy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgramData.WriteProxyChoices(choices);
|
ProgramData.WriteProxyChoices(proxyChoices);
|
||||||
loadProxyButton.Enabled = CanLoadProxy();
|
loadButton.Enabled = CanLoadSelections();
|
||||||
|
|
||||||
OnProxyChanged();
|
OnProxyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanResetDlc() => !AreSelectionsDefault();
|
||||||
|
|
||||||
private static bool CanResetProxy() => !AreProxySelectionsDefault();
|
private static bool CanResetProxy() => !AreProxySelectionsDefault();
|
||||||
|
|
||||||
private void OnResetProxy(object sender, EventArgs e)
|
private bool CanResetSelections() => CanResetDlc() || CanResetProxy();
|
||||||
|
|
||||||
|
private void OnResetSelections(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
foreach (SelectionDLC dlc in SelectionDLC.All.Keys)
|
||||||
|
{
|
||||||
|
dlc.Enabled = dlc.Name != "Unknown";
|
||||||
|
OnTreeViewNodeCheckedChanged("OnResetSelections", new(dlc.TreeNode, TreeViewAction.ByMouse));
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Selection selection in Selection.All.Keys)
|
foreach (Selection selection in Selection.All.Keys)
|
||||||
{
|
{
|
||||||
selection.UseProxy = false;
|
selection.UseProxy = false;
|
||||||
|
@ -1177,8 +1165,8 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
internal void OnProxyChanged()
|
internal void OnProxyChanged()
|
||||||
{
|
{
|
||||||
selectionTreeView.Invalidate();
|
selectionTreeView.Invalidate();
|
||||||
saveProxyButton.Enabled = CanSaveProxy();
|
saveButton.Enabled = CanSaveSelections();
|
||||||
resetProxyButton.Enabled = CanResetProxy();
|
resetButton.Enabled = CanResetSelections();
|
||||||
proxyAllCheckBox.CheckedChanged -= OnProxyAllCheckBoxChanged;
|
proxyAllCheckBox.CheckedChanged -= OnProxyAllCheckBoxChanged;
|
||||||
proxyAllCheckBox.Checked = Selection.All.Keys.All(selection => !selection.CanUseProxy || selection.UseProxy);
|
proxyAllCheckBox.Checked = Selection.All.Keys.All(selection => !selection.CanUseProxy || selection.UseProxy);
|
||||||
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
|
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
|
||||||
|
|
|
@ -1,125 +1,124 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized into a byte array
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
value : The object must be serialized into a byte array
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
: using a System.ComponentModel.TypeConverter
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
: and then encoded with base64 encoding.
|
<xsd:complexType>
|
||||||
-->
|
<xsd:choice maxOccurs="unbounded">
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
<xsd:element name="metadata">
|
||||||
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:choice maxOccurs="unbounded">
|
<xsd:sequence>
|
||||||
<xsd:element name="metadata">
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
<xsd:complexType>
|
</xsd:sequence>
|
||||||
<xsd:sequence>
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0"/>
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
</xsd:sequence>
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string"/>
|
<xsd:attribute ref="xml:space" />
|
||||||
<xsd:attribute name="type" type="xsd:string"/>
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string"/>
|
|
||||||
<xsd:attribute ref="xml:space"/>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string"/>
|
|
||||||
<xsd:attribute name="name" type="xsd:string"/>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
|
|
||||||
<xsd:attribute ref="xml:space"/>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
</xsd:schema>
|
<xsd:element name="assembly">
|
||||||
<resheader name="resmimetype">
|
<xsd:complexType>
|
||||||
<value>text/microsoft-resx</value>
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
</resheader>
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
<resheader name="version">
|
</xsd:complexType>
|
||||||
<value>2.0</value>
|
</xsd:element>
|
||||||
</resheader>
|
<xsd:element name="data">
|
||||||
<resheader name="reader">
|
<xsd:complexType>
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
|
||||||
PublicKeyToken=b77a5c561934e089
|
PublicKeyToken=b77a5c561934e089
|
||||||
</value>
|
</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
|
||||||
PublicKeyToken=b77a5c561934e089
|
PublicKeyToken=b77a5c561934e089
|
||||||
</value>
|
</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
</root>
|
</root>
|
|
@ -13,7 +13,7 @@ internal static partial class SteamCMD
|
||||||
private const int CooldownGame = 600;
|
private const int CooldownGame = 600;
|
||||||
private const int CooldownDlc = 1200;
|
private const int CooldownDlc = 1200;
|
||||||
|
|
||||||
internal static async Task<CmdAppData> QueryWebAPI(string appId, bool isDlc = false, int attempts = 0)
|
private static async Task<CmdAppData> QueryWebAPI(string appId, bool isDlc = false, int attempts = 0)
|
||||||
{
|
{
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue