- Fixed a rare Steam Store query issue
This commit is contained in:
pointfeev 2022-08-30 20:14:35 -04:00
parent 9bfefbd6f3
commit 207d2d4a2e
3 changed files with 73 additions and 26 deletions

View file

@ -5,7 +5,7 @@
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>4.1.1.0</Version>
<Version>4.1.2.0</Version>
<PackageIcon>Resources\ini.ico</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>

View file

@ -119,12 +119,11 @@ internal static class Resources
|| subPath.Contains("CRASH") && (subPath.Contains("PAD") || subPath.Contains("REPORT"));
}
internal static async Task<List<string>> GetDllDirectoriesFromGameDirectory(this string gameDirectory, Platform platform, List<string> dllDirectories = null) => await Task.Run(() =>
internal static async Task<List<string>> GetDllDirectoriesFromGameDirectory(this string gameDirectory, Platform platform) => await Task.Run(() =>
{
dllDirectories ??= new();
List<string> dllDirectories = new();
if (Program.Canceled || !Directory.Exists(gameDirectory)) return null;
List<string> directories = new(Directory.EnumerateDirectories(gameDirectory, "*", new EnumerationOptions() { RecurseSubdirectories = true })) { gameDirectory };
foreach (string subDirectory in directories)
foreach (string subDirectory in new List<string>(Directory.EnumerateDirectories(gameDirectory, "*", new EnumerationOptions() { RecurseSubdirectories = true })) { gameDirectory })
{
if (Program.Canceled) return null;
Thread.Sleep(0);

View file

@ -46,32 +46,74 @@ internal static class SteamStore
{
try
{
AppData data = JsonConvert.DeserializeObject<AppDetails>(app.Value.ToString()).data;
if (data is not null)
AppDetails appDetails = JsonConvert.DeserializeObject<AppDetails>(app.Value.ToString());
if (appDetails is not null)
{
try
AppData data = appDetails.data;
if (!appDetails.success)
{
File.WriteAllText(cacheFile, JsonConvert.SerializeObject(data, Formatting.Indented));
}
catch
#if DEBUG
(Exception e)
{
using DialogForm dialogForm = new(null);
dialogForm.Show(SystemIcons.Error, "Unsuccessful serialization of query for appid " + appId + ":\n\n" + e.ToString());
}
#else
{ }
Form.ActiveForm.Invoke(() =>
{
using DialogForm dialogForm = new(Form.ActiveForm);
dialogForm.Show(SystemIcons.Error, "Query unsuccessful for appid: " + appId + $"\nisDlc: {isDlc}\ndata is null: {data is null}\n\n" + app.Value.ToString());
});
#endif
if (data is null)
return null;
}
if (data is not null)
{
try
{
File.WriteAllText(cacheFile, JsonConvert.SerializeObject(data, Formatting.Indented));
}
catch
#if DEBUG
(Exception e)
{
Form.ActiveForm.Invoke(() =>
{
using DialogForm dialogForm = new(Form.ActiveForm);
dialogForm.Show(SystemIcons.Error, "Unsuccessful serialization of query for appid " + appId + ":\n\n" + e.ToString());
});
}
#else
{ }
#endif
return data;
}
#if DEBUG
else
{
Form.ActiveForm.Invoke(() =>
{
using DialogForm dialogForm = new(Form.ActiveForm);
dialogForm.Show(SystemIcons.Error, "Response data null for appid: " + appId + "\n\n" + app.Value.ToString());
});
}
#endif
return data;
}
#if DEBUG
else
{
Form.ActiveForm.Invoke(() =>
{
using DialogForm dialogForm = new(Form.ActiveForm);
dialogForm.Show(SystemIcons.Error, "Response details null for appid: " + appId + "\n\n" + app.Value.ToString());
});
}
#endif
}
catch
#if DEBUG
(Exception e)
{
using DialogForm dialogForm = new(null);
dialogForm.Show(SystemIcons.Error, "Unsuccessful deserialization of query for appid " + appId + ":\n\n" + e.ToString());
Form.ActiveForm.Invoke(() =>
{
using DialogForm dialogForm = new(Form.ActiveForm);
dialogForm.Show(SystemIcons.Error, "Unsuccessful deserialization of query for appid " + appId + ":\n\n" + e.ToString());
});
}
#else
{ }
@ -81,16 +123,22 @@ internal static class SteamStore
#if DEBUG
else
{
using DialogForm dialogForm = new(null);
dialogForm.Show(SystemIcons.Error, "Response deserialization null for appid: " + appId);
Form.ActiveForm.Invoke(() =>
{
using DialogForm dialogForm = new(Form.ActiveForm);
dialogForm.Show(SystemIcons.Error, "Response deserialization null for appid: " + appId);
});
}
#endif
}
#if DEBUG
else
{
using DialogForm dialogForm = new(null);
dialogForm.Show(SystemIcons.Error, "Response null for appid: " + appId);
Form.ActiveForm.Invoke(() =>
{
using DialogForm dialogForm = new(Form.ActiveForm);
dialogForm.Show(SystemIcons.Error, "Response null for appid: " + appId);
});
}
#endif
}
@ -108,7 +156,7 @@ internal static class SteamStore
if (!isDlc)
{
Thread.Sleep(1000);
return await QueryStoreAPI(appId);
return await QueryStoreAPI(appId, isDlc);
}
return null;
}