Remove Old Buttons / Relocate Uninstall All Button

- Removes the old Save/Load buttons on the main window as they don't provide a real purpose with the new changes of loading installed DLC Unlockers
- Removes the Reset button as it clears the loaded settings which really serves no effective purpose with the new changes
- Moves the Uninstall All button to the Main Window since it doesn't really make sense for it to live on the Rescan window
- Add prompt on Uninstall All to confirm you actually WANT to remove EVERYTHING
This commit is contained in:
Frog
2026-07-06 23:28:36 -07:00
parent 81fe387d8b
commit 16811a7ddb
4 changed files with 73 additions and 216 deletions
+14
View File
@@ -383,6 +383,20 @@ internal sealed partial class InstallForm : CustomForm
}
}
// Persist DLC checkbox state so it is restored on next scan without requiring a manual Save
if (!uninstalling)
{
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);
}
SelectForm.Current?.Invoke(() => SelectForm.Current?.InvalidateGameList());
Program.Cleanup();
-17
View File
@@ -31,7 +31,6 @@ namespace CreamInstaller.Forms
cancelButton = new Button();
loadButton = new Button();
saveButton = new Button();
uninstallAllButton = new Button();
selectionTreeView = new CustomTreeView();
filterTextBox = new System.Windows.Forms.TextBox();
groupBox.SuspendLayout();
@@ -170,20 +169,6 @@ namespace CreamInstaller.Forms
saveButton.UseVisualStyleBackColor = true;
saveButton.Click += OnSave;
//
// uninstallAllButton
//
uninstallAllButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
uninstallAllButton.AutoSize = true;
uninstallAllButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
uninstallAllButton.DialogResult = DialogResult.Abort;
uninstallAllButton.Location = new System.Drawing.Point(95, 243);
uninstallAllButton.Name = "uninstallAllButton";
uninstallAllButton.Padding = new Padding(12, 0, 12, 0);
uninstallAllButton.Size = new System.Drawing.Size(104, 25);
uninstallAllButton.TabIndex = 7;
uninstallAllButton.Text = "Uninstall All";
uninstallAllButton.UseVisualStyleBackColor = true;
//
// SelectDialogForm
//
AcceptButton = acceptButton;
@@ -192,7 +177,6 @@ namespace CreamInstaller.Forms
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new System.Drawing.Size(548, 279);
Controls.Add(uninstallAllButton);
Controls.Add(sortCheckBox);
Controls.Add(saveButton);
Controls.Add(loadButton);
@@ -226,7 +210,6 @@ namespace CreamInstaller.Forms
private Button loadButton;
private Button saveButton;
private CheckBox sortCheckBox;
private Button uninstallAllButton;
private System.Windows.Forms.TextBox filterTextBox;
}
}
+17 -54
View File
@@ -38,13 +38,11 @@ namespace CreamInstaller.Forms
progressBar = new ProgressBar();
progressLabel = new Label();
scanButton = new Button();
uninstallAllButton = new Button();
uninstallButton = new Button();
progressLabelGames = new Label();
progressLabelDLCs = new Label();
sortCheckBox = new CheckBox();
saveButton = new Button();
loadButton = new Button();
resetButton = new Button();
saveFlowPanel = new FlowLayoutPanel();
selectionTreeView = new CustomTreeView();
topOptionsTable = new TableLayoutPanel();
@@ -307,6 +305,20 @@ namespace CreamInstaller.Forms
scanButton.UseVisualStyleBackColor = true;
scanButton.Click += OnScan;
//
// uninstallAllButton
//
uninstallAllButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
uninstallAllButton.AutoSize = true;
uninstallAllButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
uninstallAllButton.Location = new System.Drawing.Point(327, 376);
uninstallAllButton.Name = "uninstallAllButton";
uninstallAllButton.Padding = new Padding(3, 0, 3, 0);
uninstallAllButton.Size = new System.Drawing.Size(87, 25);
uninstallAllButton.TabIndex = 10003;
uninstallAllButton.Text = "Uninstall All";
uninstallAllButton.UseVisualStyleBackColor = true;
uninstallAllButton.Click += OnUninstallAll;
//
// uninstallButton
//
uninstallButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
@@ -355,59 +367,11 @@ namespace CreamInstaller.Forms
sortCheckBox.Text = "Sort By Name";
sortCheckBox.CheckedChanged += OnSortCheckBoxChanged;
//
// saveButton
//
saveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
saveButton.AutoSize = true;
saveButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
saveButton.Enabled = false;
saveButton.Location = new System.Drawing.Point(51, 0);
saveButton.Margin = new Padding(6, 0, 6, 0);
saveButton.Name = "saveButton";
saveButton.Size = new System.Drawing.Size(41, 25);
saveButton.TabIndex = 10006;
saveButton.Text = "Save";
saveButton.UseVisualStyleBackColor = true;
saveButton.Click += OnSaveSelections;
//
// loadButton
//
loadButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
loadButton.AutoSize = true;
loadButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
loadButton.Enabled = false;
loadButton.Location = new System.Drawing.Point(98, 0);
loadButton.Margin = new Padding(0);
loadButton.Name = "loadButton";
loadButton.Size = new System.Drawing.Size(43, 25);
loadButton.TabIndex = 10005;
loadButton.Text = "Load";
loadButton.UseVisualStyleBackColor = true;
loadButton.Click += OnLoadSelections;
//
// resetButton
//
resetButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
resetButton.AutoSize = true;
resetButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
resetButton.Enabled = false;
resetButton.Location = new System.Drawing.Point(0, 0);
resetButton.Margin = new Padding(0);
resetButton.Name = "resetButton";
resetButton.Size = new System.Drawing.Size(45, 25);
resetButton.TabIndex = 10007;
resetButton.Text = "Reset";
resetButton.UseVisualStyleBackColor = true;
resetButton.Click += OnResetSelections;
//
// saveFlowPanel
//
saveFlowPanel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
saveFlowPanel.AutoSize = true;
saveFlowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
saveFlowPanel.Controls.Add(resetButton);
saveFlowPanel.Controls.Add(saveButton);
saveFlowPanel.Controls.Add(loadButton);
saveFlowPanel.Location = new System.Drawing.Point(263, 376);
saveFlowPanel.Name = "saveFlowPanel";
saveFlowPanel.Size = new System.Drawing.Size(141, 25);
@@ -451,6 +415,7 @@ namespace CreamInstaller.Forms
Controls.Add(sortCheckBox);
Controls.Add(progressLabelDLCs);
Controls.Add(progressLabelGames);
Controls.Add(uninstallAllButton);
Controls.Add(uninstallButton);
Controls.Add(scanButton);
Controls.Add(programsGroupBox);
@@ -503,14 +468,12 @@ namespace CreamInstaller.Forms
private FlowLayoutPanel darkModeFlowPanel;
private FlowLayoutPanel allCheckBoxLayoutPanel;
private Button uninstallButton;
private Button uninstallAllButton;
private Label progressLabelGames;
private Label progressLabelDLCs;
private CheckBox sortCheckBox;
private FlowLayoutPanel proxyFlowPanel;
internal CheckBox proxyAllCheckBox;
private Button saveButton;
private Button loadButton;
private Button resetButton;
private FlowLayoutPanel saveFlowPanel;
private TableLayoutPanel topOptionsTable;
private CheckBox darkModeCheckBox;
+42 -145
View File
@@ -693,9 +693,6 @@ internal sealed partial class SelectForm : CustomForm
installButton.Enabled = false;
uninstallButton.Enabled = installButton.Enabled;
selectionTreeView.Enabled = false;
saveButton.Enabled = false;
loadButton.Enabled = false;
resetButton.Enabled = false;
progressLabel.Text = "Waiting for user to select which programs/games to scan . . .";
ShowProgressBar();
await ProgramData.Setup(this);
@@ -743,35 +740,7 @@ internal sealed partial class SelectForm : CustomForm
using SelectDialogForm form = new(this);
DialogResult selectResult = form.QueryUser("Choose which programs and/or games to scan:", gameChoices,
out List<(Platform platform, string id, string name)> choices);
if (selectResult == DialogResult.Abort)
{
int maxProgress = 0;
int curProgress = 0;
Progress<int> progress = new();
IProgress<int> iProgress = progress;
progress.ProgressChanged += (_, _progress) =>
{
if (Program.Canceled)
return;
if (_progress < 0 || _progress > maxProgress)
maxProgress = -_progress;
else
curProgress = _progress;
int p = Math.Max(Math.Min((int)((float)curProgress / maxProgress * 100), 100), 0);
progressLabel.Text = $"Quickly gathering games for uninstallation . . . {p}%";
progressBar.Value = p;
};
progressLabel.Text = "Quickly gathering games for uninstallation . . . ";
foreach (Selection selection in Selection.All.Keys)
selection.TreeNode.Remove();
await GetApplicablePrograms(iProgress, true);
if (!Program.Canceled)
OnUninstall(null, null);
Selection.All.Clear();
programsToScan = null;
}
else
scan = selectResult == DialogResult.OK && choices is not null && choices.Count > 0;
scan = selectResult == DialogResult.OK && choices is not null && choices.Count > 0;
const string retry = "\n\nPress the \"Rescan\" button to re-choose.";
if (scan)
@@ -829,7 +798,7 @@ internal sealed partial class SelectForm : CustomForm
await SteamCMD.Cleanup();
}
OnLoadSelections(null, null);
LoadSelections();
await LoadSavedInstalledGames();
HideProgressBar();
selectionTreeView.Enabled = !Selection.All.IsEmpty;
@@ -838,9 +807,6 @@ internal sealed partial class SelectForm : CustomForm
noneFoundLabel.Visible = !selectionTreeView.Enabled;
installButton.Enabled = Selection.AllEnabled.Any();
uninstallButton.Enabled = installButton.Enabled;
saveButton.Enabled = CanSaveSelections();
loadButton.Enabled = CanLoadSelections();
resetButton.Enabled = CanResetSelections();
cancelButton.Enabled = false;
scanButton.Enabled = true;
blockedGamesCheckBox.Enabled = true;
@@ -878,10 +844,6 @@ internal sealed partial class SelectForm : CustomForm
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
installButton.Enabled = Selection.AllEnabled.Any();
uninstallButton.Enabled = installButton.Enabled;
if (sender is "OnLoadSelections" or "OnResetSelections")
return;
saveButton.Enabled = CanSaveSelections();
resetButton.Enabled = CanResetSelections();
}
private static void SyncNodeAncestors(TreeNode node)
@@ -1275,6 +1237,45 @@ internal sealed partial class SelectForm : CustomForm
private void OnUninstall(object sender, EventArgs e) => OnAccept(true);
private async void OnUninstallAll(object sender, EventArgs e)
{
using DialogForm confirm = new(this);
if (confirm.Show(SystemIcons.Warning,
"Are you sure you want to uninstall everything?\n\nThis will remove all DLC unlockers, CreamAPI, SmokeAPI, ScreamAPI, and proxy DLLs from all games.",
acceptButtonText: "Uninstall All", cancelButtonText: "Cancel", customFormText: "Uninstall All") != DialogResult.OK)
return;
cancelButton.Enabled = true;
scanButton.Enabled = false;
installButton.Enabled = false;
uninstallButton.Enabled = false;
selectionTreeView.Enabled = false;
int maxProgress = 0;
int curProgress = 0;
Progress<int> progress = new();
IProgress<int> iProgress = progress;
progress.ProgressChanged += (_, _progress) =>
{
if (Program.Canceled)
return;
if (_progress < 0 || _progress > maxProgress)
maxProgress = -_progress;
else
curProgress = _progress;
int p = Math.Max(Math.Min((int)((float)curProgress / maxProgress * 100), 100), 0);
progressLabel.Text = $"Quickly gathering games for uninstallation . . . {p}%";
progressBar.Value = p;
};
ShowProgressBar();
progressLabel.Text = "Quickly gathering games for uninstallation . . . ";
foreach (Selection selection in Selection.All.Keys)
selection.TreeNode.Remove();
await GetApplicablePrograms(iProgress, true);
if (!Program.Canceled)
OnUninstall(null, null);
Selection.All.Clear();
programsToScan = null;
}
private void OnScan(object sender, EventArgs e) => OnLoad(forceProvideChoices: true);
private void OnCancel(object sender, EventArgs e)
@@ -1306,80 +1307,9 @@ internal sealed partial class SelectForm : CustomForm
proxyAllCheckBox.CheckedChanged -= OnProxyAllCheckBoxChanged;
proxyAllCheckBox.Checked = shouldEnable;
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
resetButton.Enabled = CanResetSelections();
saveButton.Enabled = CanSaveSelections();
}
private bool AreSelectionsDefault()
=> EnumerateTreeNodes(selectionTreeView.Nodes).All(node
=> node.Parent is null || node.Tag is not Platform and not DLCType ||
(node.Text == "Unknown" ? !node.Checked : node.Checked));
private static bool AreProxySelectionsDefault() => Selection.All.Keys.All(selection => !selection.UseProxy);
private static bool AreExtraProtectionSelectionsDefault() => Selection.All.Keys.All(selection => !selection.UseExtraProtection);
private bool CanSaveDlc() =>
installButton.Enabled && (ProgramData.ReadDlcChoices().Any() || !AreSelectionsDefault());
private static bool CanSaveProxy() =>
ProgramData.ReadProxyChoices().Any() || !AreProxySelectionsDefault();
private static bool CanSaveExtraProtection() =>
ProgramData.ReadExtraProtectionChoices().Any() || !AreExtraProtectionSelectionsDefault();
private bool CanSaveSelections() => CanSaveDlc() || CanSaveProxy() || CanSaveExtraProtection();
private void OnSaveSelections(object sender, EventArgs e)
{
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();
foreach (Selection selection in Selection.All.Keys)
{
_ = proxyChoices.RemoveAll(c => c.platform == selection.Platform && c.id == selection.Id);
if (selection.UseProxy)
proxyChoices.Add((selection.Platform, selection.Id,
selection.Proxy == Selection.DefaultProxy ? null : selection.Proxy,
selection.UseProxy));
}
ProgramData.WriteProxyChoices(proxyChoices);
List<(Platform platform, string id)> extraProtectionChoices =
ProgramData.ReadExtraProtectionChoices().ToList();
foreach (Selection selection in Selection.All.Keys)
{
_ = extraProtectionChoices.RemoveAll(c => c.platform == selection.Platform && c.id == selection.Id);
if (selection.UseExtraProtection)
extraProtectionChoices.Add((selection.Platform, selection.Id));
}
ProgramData.WriteExtraProtectionChoices(extraProtectionChoices);
loadButton.Enabled = CanLoadSelections();
saveButton.Enabled = CanSaveSelections();
}
private static bool CanLoadDlc() => ProgramData.ReadDlcChoices().Any();
private static bool CanLoadProxy() => ProgramData.ReadProxyChoices().Any();
private static bool CanLoadExtraProtection() => ProgramData.ReadExtraProtectionChoices().Any();
private static bool CanLoadSelections() => CanLoadDlc() || CanLoadProxy() || CanLoadExtraProtection();
private void OnLoadSelections(object sender, EventArgs e)
private void LoadSelections()
{
List<(Platform platform, string gameId, string dlcId)> dlcChoices = ProgramData.ReadDlcChoices().ToList();
foreach (SelectionDLC dlc in SelectionDLC.All.Keys)
@@ -1427,7 +1357,6 @@ internal sealed partial class SelectForm : CustomForm
c.platform == selection.Platform && c.id == selection.Id);
ProgramData.WriteExtraProtectionChoices(extraProtectionChoices);
loadButton.Enabled = CanLoadSelections();
// Detect installed unlockers and proxy DLLs from disk for all selections
foreach (Selection selection in Selection.All.Keys)
@@ -1486,39 +1415,11 @@ internal sealed partial class SelectForm : CustomForm
OnProxyChanged();
}
private bool CanResetDlc() => !AreSelectionsDefault();
private static bool CanResetProxy() => !AreProxySelectionsDefault();
private static bool CanResetExtraProtection() => !AreExtraProtectionSelectionsDefault();
private bool CanResetSelections() => CanResetDlc() || CanResetProxy() || CanResetExtraProtection();
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)
{
selection.UseProxy = false;
selection.Proxy = null;
selection.UseExtraProtection = false;
}
OnProxyChanged();
}
internal void InvalidateGameList() => selectionTreeView.Invalidate();
internal void OnProxyChanged()
{
selectionTreeView.Invalidate();
saveButton.Enabled = CanSaveSelections();
resetButton.Enabled = CanResetSelections();
proxyAllCheckBox.CheckedChanged -= OnProxyAllCheckBoxChanged;
proxyAllCheckBox.Checked = Selection.All.Keys.Count != 0 && Selection.All.Keys.All(selection => selection.UseProxy);
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
@@ -1527,8 +1428,6 @@ internal sealed partial class SelectForm : CustomForm
internal void OnExtraProtectionChanged()
{
selectionTreeView.Invalidate();
saveButton.Enabled = CanSaveSelections();
resetButton.Enabled = CanResetSelections();
}
private void OnBlockProtectedGamesCheckBoxChanged(object sender, EventArgs e)
@@ -1566,8 +1465,6 @@ internal sealed partial class SelectForm : CustomForm
{
Program.UseSmokeAPI = useSmokeAPICheckBox.Checked;
selectionTreeView.Invalidate();
saveButton.Enabled = CanSaveSelections();
resetButton.Enabled = CanResetSelections();
}
private void OnUseSmokeAPIHelpButtonClicked(object sender, EventArgs e)