This commit is contained in:
pointfeev 2021-11-06 06:07:27 -04:00
parent 1d9af895d7
commit 70fe9bfae8
No known key found for this signature in database
GPG key ID: AA14DC36C4D7D13C
2 changed files with 9 additions and 10 deletions

View file

@ -138,17 +138,17 @@ namespace CreamInstaller
if (Program.Canceled) return; if (Program.Canceled) return;
List<Task> dlcTasks = new(); List<Task> dlcTasks = new();
List<int> dlcIds = new(); List<int> dlcIds = new();
if (!(appInfo is null) && !(appInfo.Value is VValue)) if (!(appInfo is null))
{ {
if (!(appInfo.Value["extended"] is null) && !(appInfo.Value["extended"] is VValue)) if (!(appInfo.Value["extended"] is null))
foreach (VProperty property in appInfo.Value["extended"]) foreach (VProperty property in appInfo.Value["extended"])
if (property.Key.ToString() == "listofdlc") if (property.Key.ToString() == "listofdlc")
foreach (string id in property.Value.ToString().Split(",")) foreach (string id in property.Value.ToString().Split(","))
if (!dlcIds.Contains(int.Parse(id))) if (!dlcIds.Contains(int.Parse(id)))
dlcIds.Add(int.Parse(id)); dlcIds.Add(int.Parse(id));
if (!(appInfo.Value["depots"] is null) && !(appInfo.Value["depots"] is VValue)) if (!(appInfo.Value["depots"] is null))
foreach (VProperty _property in appInfo.Value["depots"]) foreach (VProperty _property in appInfo.Value["depots"])
if (int.TryParse(_property.Key.ToString(), out int _) && !(_property.Value is VValue)) if (int.TryParse(_property.Key.ToString(), out int _))
if (int.TryParse(_property.Value?["dlcappid"]?.ToString(), out int appid) && !dlcIds.Contains(appid)) if (int.TryParse(_property.Value?["dlcappid"]?.ToString(), out int appid) && !dlcIds.Contains(appid))
dlcIds.Add(appid); dlcIds.Add(appid);
} }

View file

@ -77,15 +77,14 @@ namespace CreamInstaller
} }
if (Program.Canceled || output is null) return false; if (Program.Canceled || output is null) return false;
appInfo = VdfConvert.Deserialize(output); appInfo = VdfConvert.Deserialize(output);
if (appInfo?.Value is VValue || appInfo?.Value?["common"] is VValue) return true; if (appInfo?.Value?.Children()?.ToList()?.Count > 0) return true;
VToken type = appInfo?.Value?["common"]?["type"]; VToken type = null;
try { type = appInfo?.Value?["common"]?["type"]; } catch { }
if (type is null || type.ToString() == "Game") if (type is null || type.ToString() == "Game")
{ {
if (appInfo?.Value?["depots"] is VValue) return true; string buildid = null;
if (appInfo?.Value?["depots"]?["public"] is VValue) return true; try { buildid = appInfo.Value["depots"]["public"]["buildid"].ToString(); } catch { }
string buildid = appInfo?.Value?["depots"]?["public"]?["buildid"]?.ToString();
if (buildid is null && !(type is null)) return true; 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 (type is null || int.Parse(buildid?.ToString()) < buildId || appInfo.Value["extended"] is null || appInfo.Value["depots"] is null)
{ {
File.Delete(appUpdateFile); File.Delete(appUpdateFile);