- Added a quick uninstall all button to the pre-scan selection dialog
This commit is contained in:
pointfeev 2023-03-02 14:38:35 -05:00
parent c8c3354379
commit a7b8e893b2
3 changed files with 189 additions and 152 deletions

View file

@ -4,7 +4,7 @@
<TargetFramework>net7.0-windows</TargetFramework> <TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>True</UseWindowsForms> <UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon> <ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<Version>4.7.0.2</Version> <Version>4.7.1.0</Version>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright> <Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
<Company>CreamInstaller</Company> <Company>CreamInstaller</Company>
<Product>Automatic DLC Unlocker Installer &amp; Configuration Generator</Product> <Product>Automatic DLC Unlocker Installer &amp; Configuration Generator</Product>

View file

@ -1,5 +1,6 @@
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
using CreamInstaller.Components; using CreamInstaller.Components;
namespace CreamInstaller.Forms namespace CreamInstaller.Forms
@ -22,176 +23,190 @@ namespace CreamInstaller.Forms
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.acceptButton = new System.Windows.Forms.Button(); acceptButton = new Button();
this.groupBox = new System.Windows.Forms.GroupBox(); groupBox = new GroupBox();
this.allCheckBoxFlowPanel = new System.Windows.Forms.FlowLayoutPanel(); allCheckBoxFlowPanel = new FlowLayoutPanel();
this.allCheckBox = new System.Windows.Forms.CheckBox(); allCheckBox = new CheckBox();
this.sortCheckBox = new System.Windows.Forms.CheckBox(); sortCheckBox = new CheckBox();
this.cancelButton = new System.Windows.Forms.Button(); cancelButton = new Button();
this.loadButton = new System.Windows.Forms.Button(); loadButton = new Button();
this.saveButton = new System.Windows.Forms.Button(); saveButton = new Button();
this.selectionTreeView = new Components.CustomTreeView(); selectionTreeView = new CustomTreeView();
this.groupBox.SuspendLayout(); uninstallAllButton = new Button();
this.allCheckBoxFlowPanel.SuspendLayout(); groupBox.SuspendLayout();
this.SuspendLayout(); allCheckBoxFlowPanel.SuspendLayout();
SuspendLayout();
// //
// acceptButton // acceptButton
// //
this.acceptButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); acceptButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
this.acceptButton.AutoSize = true; acceptButton.AutoSize = true;
this.acceptButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; acceptButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.acceptButton.DialogResult = System.Windows.Forms.DialogResult.OK; acceptButton.DialogResult = DialogResult.OK;
this.acceptButton.FlatStyle = System.Windows.Forms.FlatStyle.System; acceptButton.FlatStyle = FlatStyle.System;
this.acceptButton.Location = new System.Drawing.Point(360, 243); acceptButton.Location = new System.Drawing.Point(475, 243);
this.acceptButton.Name = "acceptButton"; acceptButton.Name = "acceptButton";
this.acceptButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0); acceptButton.Padding = new Padding(12, 0, 12, 0);
this.acceptButton.Size = new System.Drawing.Size(61, 24); acceptButton.Size = new System.Drawing.Size(61, 24);
this.acceptButton.TabIndex = 6; acceptButton.TabIndex = 6;
this.acceptButton.Text = "OK"; acceptButton.Text = "OK";
this.acceptButton.UseVisualStyleBackColor = true; acceptButton.UseVisualStyleBackColor = true;
// //
// groupBox // groupBox
// //
this.groupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
| System.Windows.Forms.AnchorStyles.Left) groupBox.Controls.Add(selectionTreeView);
| System.Windows.Forms.AnchorStyles.Right))); groupBox.Controls.Add(allCheckBoxFlowPanel);
this.groupBox.Controls.Add(this.selectionTreeView); groupBox.Location = new System.Drawing.Point(12, 12);
this.groupBox.Controls.Add(this.allCheckBoxFlowPanel); groupBox.MinimumSize = new System.Drawing.Size(240, 40);
this.groupBox.Location = new System.Drawing.Point(12, 12); groupBox.Name = "groupBox";
this.groupBox.MinimumSize = new System.Drawing.Size(240, 40); groupBox.Size = new System.Drawing.Size(524, 225);
this.groupBox.Name = "groupBox"; groupBox.TabIndex = 3;
this.groupBox.Size = new System.Drawing.Size(409, 225); groupBox.TabStop = false;
this.groupBox.TabIndex = 3; groupBox.Text = "Choices";
this.groupBox.TabStop = false;
this.groupBox.Text = "Choices";
// //
// selectionTreeView // selectionTreeView
// //
this.selectionTreeView.BackColor = System.Drawing.SystemColors.Control; selectionTreeView.BackColor = System.Drawing.SystemColors.Control;
this.selectionTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; selectionTreeView.BorderStyle = BorderStyle.None;
this.selectionTreeView.CheckBoxes = true; selectionTreeView.CheckBoxes = true;
this.selectionTreeView.Dock = System.Windows.Forms.DockStyle.Fill; selectionTreeView.Dock = DockStyle.Fill;
this.selectionTreeView.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll; selectionTreeView.DrawMode = TreeViewDrawMode.OwnerDrawAll;
this.selectionTreeView.Location = new System.Drawing.Point(3, 19); selectionTreeView.Location = new System.Drawing.Point(3, 19);
this.selectionTreeView.Name = "selectionTreeView"; selectionTreeView.Name = "selectionTreeView";
this.selectionTreeView.ShowLines = false; selectionTreeView.ShowLines = false;
this.selectionTreeView.ShowPlusMinus = false; selectionTreeView.ShowPlusMinus = false;
this.selectionTreeView.ShowRootLines = false; selectionTreeView.ShowRootLines = false;
this.selectionTreeView.Size = new System.Drawing.Size(403, 203); selectionTreeView.Size = new System.Drawing.Size(518, 203);
this.selectionTreeView.Sorted = true; selectionTreeView.Sorted = true;
this.selectionTreeView.TabIndex = 0; selectionTreeView.TabIndex = 0;
// //
// allCheckBoxFlowPanel // allCheckBoxFlowPanel
// //
this.allCheckBoxFlowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); allCheckBoxFlowPanel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
this.allCheckBoxFlowPanel.AutoSize = true; allCheckBoxFlowPanel.AutoSize = true;
this.allCheckBoxFlowPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; allCheckBoxFlowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.allCheckBoxFlowPanel.Controls.Add(this.allCheckBox); allCheckBoxFlowPanel.Controls.Add(allCheckBox);
this.allCheckBoxFlowPanel.Location = new System.Drawing.Point(370, -1); allCheckBoxFlowPanel.Location = new System.Drawing.Point(485, -1);
this.allCheckBoxFlowPanel.Margin = new System.Windows.Forms.Padding(0); allCheckBoxFlowPanel.Margin = new Padding(0);
this.allCheckBoxFlowPanel.Name = "allCheckBoxFlowPanel"; allCheckBoxFlowPanel.Name = "allCheckBoxFlowPanel";
this.allCheckBoxFlowPanel.Size = new System.Drawing.Size(34, 19); allCheckBoxFlowPanel.Size = new System.Drawing.Size(34, 19);
this.allCheckBoxFlowPanel.TabIndex = 1007; allCheckBoxFlowPanel.TabIndex = 1007;
// //
// allCheckBox // allCheckBox
// //
this.allCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); allCheckBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
this.allCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System; allCheckBox.FlatStyle = FlatStyle.System;
this.allCheckBox.Location = new System.Drawing.Point(2, 0); allCheckBox.Location = new System.Drawing.Point(2, 0);
this.allCheckBox.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0); allCheckBox.Margin = new Padding(2, 0, 0, 0);
this.allCheckBox.Name = "allCheckBox"; allCheckBox.Name = "allCheckBox";
this.allCheckBox.Size = new System.Drawing.Size(32, 19); allCheckBox.Size = new System.Drawing.Size(32, 19);
this.allCheckBox.TabIndex = 1; allCheckBox.TabIndex = 1;
this.allCheckBox.Text = "All"; allCheckBox.Text = "All";
this.allCheckBox.CheckedChanged += new System.EventHandler(this.OnAllCheckBoxChanged); allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
// //
// sortCheckBox // sortCheckBox
// //
this.sortCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); sortCheckBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
this.sortCheckBox.AutoSize = true; sortCheckBox.AutoSize = true;
this.sortCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System; sortCheckBox.FlatStyle = FlatStyle.System;
this.sortCheckBox.Location = new System.Drawing.Point(105, 245); sortCheckBox.Location = new System.Drawing.Point(220, 245);
this.sortCheckBox.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); sortCheckBox.Margin = new Padding(3, 0, 0, 0);
this.sortCheckBox.Name = "sortCheckBox"; sortCheckBox.Name = "sortCheckBox";
this.sortCheckBox.Size = new System.Drawing.Size(104, 20); sortCheckBox.Size = new System.Drawing.Size(104, 20);
this.sortCheckBox.TabIndex = 3; sortCheckBox.TabIndex = 3;
this.sortCheckBox.Text = "Sort By Name"; sortCheckBox.Text = "Sort By Name";
this.sortCheckBox.CheckedChanged += new System.EventHandler(this.OnSortCheckBoxChanged); sortCheckBox.CheckedChanged += OnSortCheckBoxChanged;
// //
// cancelButton // cancelButton
// //
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); cancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
this.cancelButton.AutoSize = true; cancelButton.AutoSize = true;
this.cancelButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; cancelButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; cancelButton.DialogResult = DialogResult.Cancel;
this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System; cancelButton.FlatStyle = FlatStyle.System;
this.cancelButton.Location = new System.Drawing.Point(12, 243); cancelButton.Location = new System.Drawing.Point(12, 243);
this.cancelButton.Name = "cancelButton"; cancelButton.Name = "cancelButton";
this.cancelButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0); cancelButton.Padding = new Padding(12, 0, 12, 0);
this.cancelButton.Size = new System.Drawing.Size(81, 24); cancelButton.Size = new System.Drawing.Size(81, 24);
this.cancelButton.TabIndex = 2; cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel"; cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true; cancelButton.UseVisualStyleBackColor = true;
// //
// loadButton // loadButton
// //
this.loadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); loadButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
this.loadButton.AutoSize = true; loadButton.AutoSize = true;
this.loadButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; loadButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.loadButton.Enabled = false; loadButton.Enabled = false;
this.loadButton.FlatStyle = System.Windows.Forms.FlatStyle.System; loadButton.FlatStyle = FlatStyle.System;
this.loadButton.Location = new System.Drawing.Point(283, 243); loadButton.Location = new System.Drawing.Point(398, 243);
this.loadButton.Name = "loadButton"; loadButton.Name = "loadButton";
this.loadButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0); loadButton.Padding = new Padding(12, 0, 12, 0);
this.loadButton.Size = new System.Drawing.Size(71, 24); loadButton.Size = new System.Drawing.Size(71, 24);
this.loadButton.TabIndex = 5; loadButton.TabIndex = 5;
this.loadButton.Text = "Load"; loadButton.Text = "Load";
this.loadButton.UseVisualStyleBackColor = true; loadButton.UseVisualStyleBackColor = true;
this.loadButton.Click += new System.EventHandler(this.OnLoad); loadButton.Click += OnLoad;
// //
// saveButton // saveButton
// //
this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); saveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
this.saveButton.AutoSize = true; saveButton.AutoSize = true;
this.saveButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; saveButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.saveButton.Enabled = false; saveButton.Enabled = false;
this.saveButton.FlatStyle = System.Windows.Forms.FlatStyle.System; saveButton.FlatStyle = FlatStyle.System;
this.saveButton.Location = new System.Drawing.Point(208, 243); saveButton.Location = new System.Drawing.Point(323, 243);
this.saveButton.Name = "saveButton"; saveButton.Name = "saveButton";
this.saveButton.Padding = new System.Windows.Forms.Padding(12, 0, 12, 0); saveButton.Padding = new Padding(12, 0, 12, 0);
this.saveButton.Size = new System.Drawing.Size(69, 24); saveButton.Size = new System.Drawing.Size(69, 24);
this.saveButton.TabIndex = 4; saveButton.TabIndex = 4;
this.saveButton.Text = "Save"; saveButton.Text = "Save";
this.saveButton.UseVisualStyleBackColor = true; saveButton.UseVisualStyleBackColor = true;
this.saveButton.Click += new System.EventHandler(this.OnSave); saveButton.Click += OnSave;
//
// uninstallAllButton
//
uninstallAllButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
uninstallAllButton.AutoSize = true;
uninstallAllButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
uninstallAllButton.DialogResult = DialogResult.Abort;
uninstallAllButton.FlatStyle = FlatStyle.System;
uninstallAllButton.Location = new System.Drawing.Point(99, 242);
uninstallAllButton.Name = "uninstallAllButton";
uninstallAllButton.Padding = new Padding(12, 0, 12, 0);
uninstallAllButton.Size = new System.Drawing.Size(108, 24);
uninstallAllButton.TabIndex = 7;
uninstallAllButton.Text = "Uninstall All";
uninstallAllButton.UseVisualStyleBackColor = true;
// //
// SelectDialogForm // SelectDialogForm
// //
this.AcceptButton = this.acceptButton; AcceptButton = acceptButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.AutoSize = true; AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(433, 279); ClientSize = new System.Drawing.Size(548, 279);
this.Controls.Add(this.sortCheckBox); Controls.Add(uninstallAllButton);
this.Controls.Add(this.saveButton); Controls.Add(sortCheckBox);
this.Controls.Add(this.loadButton); Controls.Add(saveButton);
this.Controls.Add(this.cancelButton); Controls.Add(loadButton);
this.Controls.Add(this.acceptButton); Controls.Add(cancelButton);
this.Controls.Add(this.groupBox); Controls.Add(acceptButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; Controls.Add(groupBox);
this.MaximizeBox = false; FormBorderStyle = FormBorderStyle.FixedSingle;
this.MinimizeBox = false; MaximizeBox = false;
this.Name = "SelectDialogForm"; MinimizeBox = false;
this.ShowInTaskbar = false; Name = "SelectDialogForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; ShowInTaskbar = false;
this.Text = "SelectDialogForm"; StartPosition = FormStartPosition.Manual;
this.groupBox.ResumeLayout(false); Text = "SelectDialogForm";
this.groupBox.PerformLayout(); groupBox.ResumeLayout(false);
this.allCheckBoxFlowPanel.ResumeLayout(false); groupBox.PerformLayout();
this.ResumeLayout(false); allCheckBoxFlowPanel.ResumeLayout(false);
this.PerformLayout(); ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion
@ -205,5 +220,6 @@ namespace CreamInstaller.Forms
private Button loadButton; private Button loadButton;
private Button saveButton; private Button saveButton;
private CheckBox sortCheckBox; private CheckBox sortCheckBox;
private Button uninstallAllButton;
} }
} }

View file

@ -102,7 +102,7 @@ internal sealed partial class SelectForm : CustomForm
private async Task GetApplicablePrograms(IProgress<int> progress, bool uninstallAll = false) private async Task GetApplicablePrograms(IProgress<int> progress, bool uninstallAll = false)
{ {
if (programsToScan is null || !programsToScan.Any()) if (!uninstallAll && (programsToScan is null || !programsToScan.Any()))
return; return;
int totalGameCount = 0; int totalGameCount = 0;
int completeGameCount = 0; int completeGameCount = 0;
@ -123,14 +123,16 @@ internal sealed partial class SelectForm : CustomForm
remainingGames.Clear(); // for display purposes only, otherwise ignorable remainingGames.Clear(); // for display purposes only, otherwise ignorable
remainingDLCs.Clear(); // for display purposes only, otherwise ignorable remainingDLCs.Clear(); // for display purposes only, otherwise ignorable
List<Task> appTasks = new(); List<Task> appTasks = new();
if (programsToScan.Any(c => c.platform is Platform.Paradox)) if (uninstallAll || programsToScan.Any(c => c.platform is Platform.Paradox))
{ {
AddToRemainingGames("Paradox Launcher");
List<string> dllDirectories = await ParadoxLauncher.InstallPath.GetDllDirectoriesFromGameDirectory(Platform.Paradox, this); List<string> dllDirectories = await ParadoxLauncher.InstallPath.GetDllDirectoriesFromGameDirectory(Platform.Paradox, this);
if (dllDirectories is not null) if (dllDirectories is not null)
{ {
if (uninstallAll) if (uninstallAll)
{ {
ProgramSelection bareSelection = ProgramSelection.FromPlatformId(Platform.Paradox, "PL") ?? new(); ProgramSelection bareSelection = ProgramSelection.FromPlatformId(Platform.Paradox, "PL") ?? new();
bareSelection.Enabled = true;
bareSelection.Id = "PL"; bareSelection.Id = "PL";
bareSelection.Name = "Paradox Launcher"; bareSelection.Name = "Paradox Launcher";
bareSelection.RootDirectory = ParadoxLauncher.InstallPath; bareSelection.RootDirectory = ParadoxLauncher.InstallPath;
@ -159,10 +161,11 @@ internal sealed partial class SelectForm : CustomForm
if (programNode.TreeView is null) if (programNode.TreeView is null)
_ = selectionTreeView.Nodes.Add(programNode); _ = selectionTreeView.Nodes.Add(programNode);
} }
RemoveFromRemainingGames("Paradox Launcher");
} }
} }
int steamGamesToCheck; int steamGamesToCheck;
if (programsToScan.Any(c => c.platform is Platform.Steam)) if (uninstallAll || programsToScan.Any(c => c.platform is Platform.Steam))
{ {
List<(string appId, string name, string branch, int buildId, string gameDirectory)> steamGames = await SteamLibrary.GetGames(); List<(string appId, string name, string branch, int buildId, string gameDirectory)> steamGames = await SteamLibrary.GetGames();
steamGamesToCheck = steamGames.Count; steamGamesToCheck = steamGames.Count;
@ -197,6 +200,7 @@ internal sealed partial class SelectForm : CustomForm
bareSelection.ExecutableDirectories = await SteamLibrary.GetExecutableDirectories(bareSelection.RootDirectory); bareSelection.ExecutableDirectories = await SteamLibrary.GetExecutableDirectories(bareSelection.RootDirectory);
bareSelection.DllDirectories = dllDirectories; bareSelection.DllDirectories = dllDirectories;
bareSelection.Platform = Platform.Steam; bareSelection.Platform = Platform.Steam;
RemoveFromRemainingGames(name);
return; return;
} }
if (Program.Canceled) if (Program.Canceled)
@ -365,7 +369,7 @@ internal sealed partial class SelectForm : CustomForm
appTasks.Add(task); appTasks.Add(task);
} }
} }
if (programsToScan.Any(c => c.platform is Platform.Epic)) if (uninstallAll || programsToScan.Any(c => c.platform is Platform.Epic))
{ {
List<Manifest> epicGames = await EpicLibrary.GetGames(); List<Manifest> epicGames = await EpicLibrary.GetGames();
foreach (Manifest manifest in epicGames) foreach (Manifest manifest in epicGames)
@ -398,6 +402,7 @@ internal sealed partial class SelectForm : CustomForm
bareSelection.ExecutableDirectories = await EpicLibrary.GetExecutableDirectories(bareSelection.RootDirectory); bareSelection.ExecutableDirectories = await EpicLibrary.GetExecutableDirectories(bareSelection.RootDirectory);
bareSelection.DllDirectories = dllDirectories; bareSelection.DllDirectories = dllDirectories;
bareSelection.Platform = Platform.Epic; bareSelection.Platform = Platform.Epic;
RemoveFromRemainingGames(name);
return; return;
} }
if (Program.Canceled) if (Program.Canceled)
@ -501,7 +506,7 @@ internal sealed partial class SelectForm : CustomForm
appTasks.Add(task); appTasks.Add(task);
} }
} }
if (programsToScan.Any(c => c.platform is Platform.Ubisoft)) if (uninstallAll || programsToScan.Any(c => c.platform is Platform.Ubisoft))
{ {
List<(string gameId, string name, string gameDirectory)> ubisoftGames = await UbisoftLibrary.GetGames(); List<(string gameId, string name, string gameDirectory)> ubisoftGames = await UbisoftLibrary.GetGames();
foreach ((string gameId, string name, string gameDirectory) in ubisoftGames) foreach ((string gameId, string name, string gameDirectory) in ubisoftGames)
@ -531,6 +536,7 @@ internal sealed partial class SelectForm : CustomForm
bareSelection.ExecutableDirectories = await UbisoftLibrary.GetExecutableDirectories(bareSelection.RootDirectory); bareSelection.ExecutableDirectories = await UbisoftLibrary.GetExecutableDirectories(bareSelection.RootDirectory);
bareSelection.DllDirectories = dllDirectories; bareSelection.DllDirectories = dllDirectories;
bareSelection.Platform = Platform.Ubisoft; bareSelection.Platform = Platform.Ubisoft;
RemoveFromRemainingGames(name);
return; return;
} }
if (Program.Canceled) if (Program.Canceled)
@ -622,11 +628,26 @@ internal sealed partial class SelectForm : CustomForm
out List<(Platform platform, string id, string name)> choices); out List<(Platform platform, string id, string name)> choices);
if (selectResult == DialogResult.Abort) // will be an uninstall all button if (selectResult == DialogResult.Abort) // will be an uninstall all button
{ {
choices = new(); int maxProgress = 0;
foreach ((Platform platform, string id, string name, bool alreadySelected) in gameChoices) int curProgress = 0;
choices.Add((platform, id, name)); Progress<int> progress = new();
programsToScan = choices; IProgress<int> iProgress = progress;
await GetApplicablePrograms(new Progress<int>(), true); 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 . . . ";
if (!Program.Canceled)
await GetApplicablePrograms(iProgress, true);
if (!Program.Canceled)
OnUninstall(null, null); OnUninstall(null, null);
} }
else else