diff --git a/CreamInstaller/Classes/SteamCMD.cs b/CreamInstaller/Classes/SteamCMD.cs index f82b809..ab20839 100644 --- a/CreamInstaller/Classes/SteamCMD.cs +++ b/CreamInstaller/Classes/SteamCMD.cs @@ -112,7 +112,7 @@ internal static class SteamCMD { string buildid = appInfo.Value?.GetChild("depots")?.GetChild("branches")?.GetChild(branch)?.GetChild("buildid")?.ToString(); if (buildid is null && type is not null) return appInfo; - if (type is null || int.Parse(buildid) < buildId) + if (type is null || int.TryParse(buildid, out int gamebuildId) && gamebuildId < buildId) { List dlcAppIds = await ParseDlcAppIds(appInfo); foreach (int id in dlcAppIds) @@ -136,7 +136,7 @@ internal static class SteamCMD foreach (VProperty property in extended) if (property.Key.ToString() == "listofdlc") foreach (string id in property.Value.ToString().Split(",")) - if (!dlcIds.Contains(int.Parse(id))) dlcIds.Add(int.Parse(id)); + if (int.TryParse(id, out int appId) && !dlcIds.Contains(appId)) dlcIds.Add(appId); VToken depots = appInfo.Value.GetChild("depots"); if (depots is not null) foreach (VProperty property in depots) if (int.TryParse(property.Key.ToString(), out int _) diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj index dc4bd4d..a5c5433 100644 --- a/CreamInstaller/CreamInstaller.csproj +++ b/CreamInstaller/CreamInstaller.csproj @@ -5,7 +5,7 @@ true Resources\ini.ico true - 2.2.4.2 + 2.2.4.3 Resources\ini.ico 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. diff --git a/CreamInstaller/Forms/SelectForm.cs b/CreamInstaller/Forms/SelectForm.cs index 9bc16f0..07e9d3d 100644 --- a/CreamInstaller/Forms/SelectForm.cs +++ b/CreamInstaller/Forms/SelectForm.cs @@ -334,15 +334,15 @@ internal partial class SelectForm : CustomForm { if (e.Action == TreeViewAction.Unknown) return; TreeNode node = e.Node; - if (node is not null) + if (node is not null && int.TryParse(node.Name, out int appId)) { - ProgramSelection selection = ProgramSelection.FromAppId(int.Parse(node.Name)); + ProgramSelection selection = ProgramSelection.FromAppId(appId); if (selection is null) { TreeNode parent = node.Parent; - if (parent is not null) + if (parent is not null && int.TryParse(parent.Name, out int gameAppId)) { - ProgramSelection.FromAppId(int.Parse(parent.Name)).ToggleDlc(int.Parse(node.Name), node.Checked); + ProgramSelection.FromAppId(gameAppId).ToggleDlc(appId, node.Checked); parent.Checked = parent.Nodes.Cast().ToList().Any(treeNode => treeNode.Checked); } }