bits for v2.0.3.0

This commit is contained in:
pointfeev 2021-11-22 02:13:02 -05:00
parent 6024b0287f
commit 4ffca7c807
No known key found for this signature in database
GPG key ID: AA14DC36C4D7D13C
4 changed files with 73 additions and 53 deletions

View file

@ -6,7 +6,7 @@
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>ini.ico</ApplicationIcon> <ApplicationIcon>ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>2.0.2.3</Version> <Version>2.0.3.0</Version>
<PackageIcon>ini.ico</PackageIcon> <PackageIcon>ini.ico</PackageIcon>
<PackageIconUrl /> <PackageIconUrl />
<Description>Automatically generates and installs CreamAPI files for Steam games on the user's computer. It can also generate and install CreamAPI for the Paradox Launcher should the user select a Paradox Interactive game.</Description> <Description>Automatically generates and installs CreamAPI files for Steam games on the user's computer. It can also generate and install CreamAPI for the Paradox Launcher should the user select a Paradox Interactive game.</Description>

View file

@ -123,8 +123,6 @@ namespace CreamInstaller
// //
this.allCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.allCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.allCheckBox.AutoSize = true; this.allCheckBox.AutoSize = true;
this.allCheckBox.Checked = true;
this.allCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.allCheckBox.Enabled = false; this.allCheckBox.Enabled = false;
this.allCheckBox.Location = new System.Drawing.Point(414, 0); this.allCheckBox.Location = new System.Drawing.Point(414, 0);
this.allCheckBox.Name = "allCheckBox"; this.allCheckBox.Name = "allCheckBox";

View file

@ -121,6 +121,7 @@ namespace CreamInstaller
private void GetCreamApiApplicablePrograms(IProgress<int> progress) private void GetCreamApiApplicablePrograms(IProgress<int> progress)
{ {
treeView1.AfterCheck -= OnTreeViewNodeCheckedChanged;
int cur = 0; int cur = 0;
if (Program.Canceled) return; if (Program.Canceled) return;
List<Tuple<int, string, string, int, string>> applicablePrograms = new(); List<Tuple<int, string, string, int, string>> applicablePrograms = new();
@ -197,25 +198,28 @@ namespace CreamInstaller
if (Program.Canceled) return; if (Program.Canceled) return;
TreeNode programNode = treeNodes.Find(s => s.Text == name) ?? new(); TreeNode programNode = treeNodes.Find(s => s.Text == name) ?? new();
programNode.Text = name; programNode.Text = name;
programNode.Checked = true; programNode.Checked = selection.Enabled;
programNode.Remove(); programNode.Remove();
treeView1.Nodes.Add(programNode); treeView1.Nodes.Add(programNode);
treeNodes.Remove(programNode); treeNodes.Remove(programNode);
treeNodes.Add(programNode); treeNodes.Add(programNode);
foreach (KeyValuePair<int, string> dlcApp in dlc.ToList()) if (name == "Paradox Launcher")
{ {
if (Program.Canceled || programNode is null) return; // maybe add game and/or dlc choice here?
TreeNode dlcNode = treeNodes.Find(s => s.Text == dlcApp.Value) ?? new();
dlcNode.Text = dlcApp.Value;
dlcNode.Checked = true;
dlcNode.Remove();
programNode.Nodes.Add(dlcNode);
treeNodes.Remove(dlcNode);
treeNodes.Add(dlcNode);
Tuple<int, string> app = new(dlcApp.Key, dlcApp.Value);
if (!selection.AllSteamDlc.Contains(app)) selection.AllSteamDlc.Add(app);
if (!selection.SelectedSteamDlc.Contains(app)) selection.SelectedSteamDlc.Add(app);
} }
else foreach (KeyValuePair<int, string> dlcApp in dlc.ToList())
{
if (Program.Canceled || programNode is null) return;
Tuple<int, string> app = new(dlcApp.Key, dlcApp.Value);
TreeNode dlcNode = treeNodes.Find(s => s.Text == app.Item2) ?? new();
dlcNode.Text = app.Item2;
dlcNode.Checked = selection.SelectedSteamDlc.Contains(app);
dlcNode.Remove();
programNode.Nodes.Add(dlcNode);
treeNodes.Remove(dlcNode);
treeNodes.Add(dlcNode);
if (!selection.AllSteamDlc.Contains(app)) selection.AllSteamDlc.Add(app);
}
}); });
}); });
RunningTasks.Add(task); RunningTasks.Add(task);
@ -230,6 +234,7 @@ namespace CreamInstaller
task.Wait(); task.Wait();
} }
progress.Report(RunningTasks.Count); progress.Report(RunningTasks.Count);
treeView1.AfterCheck += OnTreeViewNodeCheckedChanged;
} }
private bool validated = false; private bool validated = false;
@ -292,21 +297,11 @@ namespace CreamInstaller
label2.Visible = false; label2.Visible = false;
progressBar1.Visible = false; progressBar1.Visible = false;
if (ProgramSelection.All.Any()) treeView1.Enabled = ProgramSelection.All.Any();
{ allCheckBox.Enabled = treeView1.Enabled;
allCheckBox.Enabled = true; noneFoundLabel.Visible = !treeView1.Enabled;
treeView1.Enabled = true;
treeNodes.ForEach(node => node.Checked = true);
if (ProgramSelection.AllSafeEnabled.Any())
{
acceptButton.Enabled = true;
}
}
else
{
noneFoundLabel.Visible = true;
}
acceptButton.Enabled = ProgramSelection.AllSafeEnabled.Any();
cancelButton.Enabled = false; cancelButton.Enabled = false;
scanButton.Enabled = true; scanButton.Enabled = true;
@ -322,23 +317,29 @@ namespace CreamInstaller
ProgramSelection selection = ProgramSelection.FromName(e.Node.Text); ProgramSelection selection = ProgramSelection.FromName(e.Node.Text);
if (selection is null) if (selection is null)
{ {
selection = ProgramSelection.FromName(e.Node.Parent.Text); ProgramSelection.FromName(e.Node.Parent.Text).ToggleDlc(e.Node.Text, e.Node.Checked);
selection.ToggleDlc(e.Node.Text, e.Node.Checked);
treeView1.AfterCheck -= OnTreeViewNodeCheckedChanged; treeView1.AfterCheck -= OnTreeViewNodeCheckedChanged;
e.Node.Parent.Checked = e.Node.Parent.Nodes.Cast<TreeNode>().ToList().Any(treeNode => treeNode.Checked); e.Node.Parent.Checked = e.Node.Parent.Nodes.Cast<TreeNode>().ToList().Any(treeNode => treeNode.Checked);
treeView1.AfterCheck += OnTreeViewNodeCheckedChanged; treeView1.AfterCheck += OnTreeViewNodeCheckedChanged;
} }
else else
{ {
selection.Enabled = e.Node.Checked; if (selection.AllSteamDlc.Any())
treeView1.AfterCheck -= OnTreeViewNodeCheckedChanged; {
e.Node.Nodes.Cast<TreeNode>().ToList().ForEach(treeNode => treeNode.Checked = e.Node.Checked); selection.ToggleAllDlc(e.Node.Checked);
treeView1.AfterCheck += OnTreeViewNodeCheckedChanged; treeView1.AfterCheck -= OnTreeViewNodeCheckedChanged;
e.Node.Nodes.Cast<TreeNode>().ToList().ForEach(treeNode => treeNode.Checked = e.Node.Checked);
treeView1.AfterCheck += OnTreeViewNodeCheckedChanged;
}
else
{
selection.Enabled = e.Node.Checked;
}
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged; allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
allCheckBox.Checked = treeNodes.TrueForAll(treeNode => treeNode.Checked); allCheckBox.Checked = treeNodes.TrueForAll(treeNode => treeNode.Checked);
allCheckBox.CheckedChanged += OnAllCheckBoxChanged; allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
acceptButton.Enabled = ProgramSelection.AllSafeEnabled.Any();
} }
acceptButton.Enabled = ProgramSelection.AllSafeEnabled.Any();
} }
private void OnLoad(object sender, EventArgs _) private void OnLoad(object sender, EventArgs _)
@ -370,10 +371,10 @@ namespace CreamInstaller
} }
} }
private static bool ParadoxLauncherDlcDialog(Form form) private static void PopulateParadoxLauncherDlc(ProgramSelection paradoxLauncher = null)
{ {
ProgramSelection paradoxLauncher = ProgramSelection.FromName("Paradox Launcher"); paradoxLauncher ??= ProgramSelection.FromName("Paradox Launcher");
if (!(paradoxLauncher is null) && paradoxLauncher.Enabled) if (!(paradoxLauncher is null))
{ {
paradoxLauncher.ExtraSteamAppIdDlc = new(); paradoxLauncher.ExtraSteamAppIdDlc = new();
foreach (ProgramSelection selection in ProgramSelection.AllSafeEnabled) foreach (ProgramSelection selection in ProgramSelection.AllSafeEnabled)
@ -391,6 +392,15 @@ namespace CreamInstaller
paradoxLauncher.ExtraSteamAppIdDlc.Add(new(selection.SteamAppId, selection.Name, selection.AllSteamDlc)); paradoxLauncher.ExtraSteamAppIdDlc.Add(new(selection.SteamAppId, selection.Name, selection.AllSteamDlc));
} }
} }
}
}
private static bool ParadoxLauncherDlcDialog(Form form)
{
ProgramSelection paradoxLauncher = ProgramSelection.FromName("Paradox Launcher");
if (!(paradoxLauncher is null) && paradoxLauncher.Enabled)
{
PopulateParadoxLauncherDlc(paradoxLauncher);
if (!paradoxLauncher.ExtraSteamAppIdDlc.Any()) if (!paradoxLauncher.ExtraSteamAppIdDlc.Any())
{ {
if (new DialogForm(form).Show(Program.ApplicationName, SystemIcons.Warning, if (new DialogForm(form).Show(Program.ApplicationName, SystemIcons.Warning,
@ -425,8 +435,11 @@ namespace CreamInstaller
{ {
foreach (TreeNode treeNode in treeNodes) foreach (TreeNode treeNode in treeNodes)
{ {
treeNode.Checked = !treeNode.Checked; if (!(treeNode.Parent is null))
treeNode.Checked = !treeNode.Checked; // to fire checked event {
treeNode.Checked = !treeNode.Checked;
treeNode.Checked = !treeNode.Checked; // to fire checked event
}
} }
int X = installForm.Location.X + installForm.Size.Width / 2 - Size.Width / 2; int X = installForm.Location.X + installForm.Size.Width / 2 - Size.Width / 2;
int Y = installForm.Location.Y + installForm.Size.Height / 2 - Size.Height / 2; int Y = installForm.Location.Y + installForm.Size.Height / 2 - Size.Height / 2;

View file

@ -7,7 +7,7 @@ namespace CreamInstaller
{ {
public class ProgramSelection public class ProgramSelection
{ {
public bool Enabled = true; public bool Enabled = false;
public string Name; public string Name;
public string RootDirectory; public string RootDirectory;
@ -34,24 +34,33 @@ namespace CreamInstaller
} }
} }
public void ToggleDlc(string dlcName, bool Enabled) private void Toggle(Tuple<int, string> dlcApp, bool enabled)
{
if (enabled)
{
if (!SelectedSteamDlc.Contains(dlcApp)) SelectedSteamDlc.Add(dlcApp);
}
else SelectedSteamDlc.Remove(dlcApp);
}
public void ToggleDlc(string dlcName, bool enabled)
{ {
foreach (Tuple<int, string> dlcApp in AllSteamDlc) foreach (Tuple<int, string> dlcApp in AllSteamDlc)
{ {
if (dlcApp.Item2 == dlcName) if (dlcApp.Item2 == dlcName)
{ {
if (Enabled) Toggle(dlcApp, enabled);
{
if (!SelectedSteamDlc.Contains(dlcApp))
{
SelectedSteamDlc.Add(dlcApp);
}
}
else SelectedSteamDlc.Remove(dlcApp);
break; break;
} }
} }
this.Enabled = SelectedSteamDlc.Any(); Enabled = SelectedSteamDlc.Any();
}
public void ToggleAllDlc(bool enabled)
{
if (!enabled) SelectedSteamDlc.Clear();
else foreach (Tuple<int, string> dlcApp in AllSteamDlc) Toggle(dlcApp, enabled);
Enabled = SelectedSteamDlc.Any();
} }
public ProgramSelection() => All.Add(this); public ProgramSelection() => All.Add(this);