diff --git a/CreamInstaller/SelectForm.cs b/CreamInstaller/SelectForm.cs index c3a6fd2..4d619e2 100644 --- a/CreamInstaller/SelectForm.cs +++ b/CreamInstaller/SelectForm.cs @@ -138,15 +138,15 @@ namespace CreamInstaller if (Program.Canceled) return; List dlcTasks = new(); List dlcIds = new(); - if (!(appInfo is null)) + if (!(appInfo is null) && !(appInfo.Value is VValue)) { - if (!(appInfo.Value["extended"] is null)) + if (!(appInfo.Value["extended"] is null) && !(appInfo.Value["extended"] is VValue)) foreach (VProperty property in appInfo.Value["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 (!(appInfo.Value["depots"] is null)) + if (!(appInfo.Value["depots"] is null) && !(appInfo.Value["depots"] is VValue)) foreach (VProperty _property in appInfo.Value["depots"]) if (int.TryParse(_property.Key.ToString(), out int _) && !(_property.Value is VValue)) if (int.TryParse(_property.Value?["dlcappid"]?.ToString(), out int appid) && !dlcIds.Contains(appid)) @@ -162,7 +162,10 @@ namespace CreamInstaller if (Program.Canceled) return; string dlcName = null; VProperty dlcAppInfo = null; - if (SteamCMD.GetAppInfo(id, 0, out dlcAppInfo)) dlcName = dlcAppInfo?.Value?["common"]?["name"]?.ToString(); + if (SteamCMD.GetAppInfo(id, 0, out dlcAppInfo) + && !(dlcAppInfo?.Value is VValue) + && !(dlcAppInfo?.Value?["common"] is VValue)) + dlcName = dlcAppInfo?.Value?["common"]?["name"]?.ToString(); if (Program.Canceled) return; if (string.IsNullOrWhiteSpace(dlcName)) dlcName = $"Unnamed DLC ({id})"; dlc.Add(new Tuple(id, dlcName)); diff --git a/CreamInstaller/SteamCMD.cs b/CreamInstaller/SteamCMD.cs index f439d05..61b4ee9 100644 --- a/CreamInstaller/SteamCMD.cs +++ b/CreamInstaller/SteamCMD.cs @@ -55,8 +55,6 @@ namespace CreamInstaller if (!File.Exists(DllPath)) Run($@"+quit", out _); } - private static Dictionary retries = new(); - public static bool GetAppInfo(int appId, int buildId, out VProperty appInfo) { appInfo = null; @@ -79,18 +77,17 @@ namespace CreamInstaller } if (Program.Canceled || output is null) return false; appInfo = VdfConvert.Deserialize(output); + if (appInfo?.Value is VValue || appInfo?.Value?["common"] is VValue) return true; VToken type = appInfo?.Value?["common"]?["type"]; if (type is null || type.ToString() == "Game") { + if (appInfo?.Value?["depots"] is VValue) return true; + if (appInfo?.Value?["depots"]?["public"] is VValue) return true; string buildid = appInfo?.Value?["depots"]?["public"]?["buildid"]?.ToString(); - if (appInfo?.Value?.Children()?.ToList()?.Count > 0 && !(buildid is null) - && (type is null || int.Parse(buildid?.ToString()) < buildId - || appInfo.Value["extended"] is null - || appInfo.Value["depots"] is null)) + if (buildid is null && !(type is null)) return true; + if (appInfo?.Value?.Children()?.ToList()?.Count > 0) return true; + if (type is null || int.Parse(buildid?.ToString()) < buildId || appInfo.Value["extended"] is null || appInfo.Value["depots"] is null) { - //if (retries.TryGetValue(appId, out int count)) retries[appId] = ++count; - //else retries.Add(appId, 1); - //if (count > 10) return false; File.Delete(appUpdateFile); bool success = GetAppInfo(appId, buildId, out appInfo); return success;