error fixes
This commit is contained in:
parent
51d3a1c9cb
commit
1d9af895d7
2 changed files with 13 additions and 13 deletions
|
@ -138,15 +138,15 @@ 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))
|
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"])
|
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))
|
if (!(appInfo.Value["depots"] is null) && !(appInfo.Value["depots"] is VValue))
|
||||||
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 _) && !(_property.Value is VValue))
|
||||||
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))
|
||||||
|
@ -162,7 +162,10 @@ namespace CreamInstaller
|
||||||
if (Program.Canceled) return;
|
if (Program.Canceled) return;
|
||||||
string dlcName = null;
|
string dlcName = null;
|
||||||
VProperty dlcAppInfo = 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 (Program.Canceled) return;
|
||||||
if (string.IsNullOrWhiteSpace(dlcName)) dlcName = $"Unnamed DLC ({id})";
|
if (string.IsNullOrWhiteSpace(dlcName)) dlcName = $"Unnamed DLC ({id})";
|
||||||
dlc.Add(new Tuple<int, string>(id, dlcName));
|
dlc.Add(new Tuple<int, string>(id, dlcName));
|
||||||
|
|
|
@ -55,8 +55,6 @@ namespace CreamInstaller
|
||||||
if (!File.Exists(DllPath)) Run($@"+quit", out _);
|
if (!File.Exists(DllPath)) Run($@"+quit", out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<int, int> retries = new();
|
|
||||||
|
|
||||||
public static bool GetAppInfo(int appId, int buildId, out VProperty appInfo)
|
public static bool GetAppInfo(int appId, int buildId, out VProperty appInfo)
|
||||||
{
|
{
|
||||||
appInfo = null;
|
appInfo = null;
|
||||||
|
@ -79,18 +77,17 @@ 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;
|
||||||
VToken type = appInfo?.Value?["common"]?["type"];
|
VToken type = appInfo?.Value?["common"]?["type"];
|
||||||
if (type is null || type.ToString() == "Game")
|
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();
|
string buildid = appInfo?.Value?["depots"]?["public"]?["buildid"]?.ToString();
|
||||||
if (appInfo?.Value?.Children()?.ToList()?.Count > 0 && !(buildid is null)
|
if (buildid is null && !(type is null)) return true;
|
||||||
&& (type is null || int.Parse(buildid?.ToString()) < buildId
|
if (appInfo?.Value?.Children()?.ToList()?.Count > 0) return true;
|
||||||
|| appInfo.Value["extended"] is null
|
if (type is null || int.Parse(buildid?.ToString()) < buildId || appInfo.Value["extended"] is null || appInfo.Value["depots"] 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);
|
File.Delete(appUpdateFile);
|
||||||
bool success = GetAppInfo(appId, buildId, out appInfo);
|
bool success = GetAppInfo(appId, buildId, out appInfo);
|
||||||
return success;
|
return success;
|
||||||
|
|
Loading…
Reference in a new issue