diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj index 11ffc83..bd8773f 100644 --- a/CreamInstaller/CreamInstaller.csproj +++ b/CreamInstaller/CreamInstaller.csproj @@ -5,7 +5,7 @@ True Resources\ini.ico true - 3.0.2.0 + 3.0.2.1 Resources\ini.ico diff --git a/CreamInstaller/Epic/EpicStore.cs b/CreamInstaller/Epic/EpicStore.cs index b50a390..3466832 100644 --- a/CreamInstaller/Epic/EpicStore.cs +++ b/CreamInstaller/Epic/EpicStore.cs @@ -20,13 +20,12 @@ internal static class EpicStore { }*/ - internal static async Task> QueryEntitlements(Manifest manifest) + internal static async Task> QueryEntitlements(string categoryNamespace) { - string @namespace = manifest.CatalogNamespace; List<(string id, string name, string product, string icon, string developer)> dlcIds = new(); - Response response = await QueryGraphQL(@namespace); + Response response = await QueryGraphQL(categoryNamespace); if (response is null) return dlcIds; - try { File.WriteAllText(ProgramData.AppInfoPath + @$"\{@namespace}.json", JsonConvert.SerializeObject(response, Formatting.Indented)); } catch { } + try { File.WriteAllText(ProgramData.AppInfoPath + @$"\{categoryNamespace}.json", JsonConvert.SerializeObject(response, Formatting.Indented)); } catch { } List searchStore = new(response.Data.Catalog.SearchStore.Elements); foreach (Element element in searchStore) { @@ -89,16 +88,23 @@ internal static class EpicStore private static async Task QueryGraphQL(string categoryNamespace) { - string encoded = HttpUtility.UrlEncode(categoryNamespace); - Request request = new(encoded); - string payload = JsonConvert.SerializeObject(request); - HttpContent content = new StringContent(payload); - content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); - HttpClient client = HttpClientManager.HttpClient; - if (client is null) return null; - HttpResponseMessage httpResponse = await client.PostAsync("https://graphql.epicgames.com/graphql", content); - httpResponse.EnsureSuccessStatusCode(); - string response = await httpResponse.Content.ReadAsStringAsync(); - return JsonConvert.DeserializeObject(response); + try + { + string encoded = HttpUtility.UrlEncode(categoryNamespace); + Request request = new(encoded); + string payload = JsonConvert.SerializeObject(request); + HttpContent content = new StringContent(payload); + content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + HttpClient client = HttpClientManager.HttpClient; + if (client is null) return null; + HttpResponseMessage httpResponse = await client.PostAsync("https://graphql.epicgames.com/graphql", content); + httpResponse.EnsureSuccessStatusCode(); + string response = await httpResponse.Content.ReadAsStringAsync(); + return JsonConvert.DeserializeObject(response); + } + catch + { + return null; + } } } diff --git a/CreamInstaller/SelectForm.cs b/CreamInstaller/SelectForm.cs index 8864534..5685267 100644 --- a/CreamInstaller/SelectForm.cs +++ b/CreamInstaller/SelectForm.cs @@ -261,7 +261,7 @@ internal partial class SelectForm : CustomForm if (Program.Canceled) return; ConcurrentDictionary entitlements = new(); List dlcTasks = new(); - List<(string id, string name, string product, string icon, string developer)> entitlementIds = await EpicStore.QueryEntitlements(manifest); + List<(string id, string name, string product, string icon, string developer)> entitlementIds = await EpicStore.QueryEntitlements(@namespace); if (entitlementIds.Any()) { foreach ((string id, string name, string product, string icon, string developer) in entitlementIds)