From c410cbdfd82b6cd5a4b03fc11e39a1f61cfdf139 Mon Sep 17 00:00:00 2001 From: pointfeev Date: Fri, 4 Mar 2022 18:42:22 -0500 Subject: [PATCH] final for now --- CreamInstaller/Epic/EpicStore.cs | 14 ++++++++------ CreamInstaller/Epic/GraphQL/Response.cs | 12 +++--------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/CreamInstaller/Epic/EpicStore.cs b/CreamInstaller/Epic/EpicStore.cs index bf24ce8..b50a390 100644 --- a/CreamInstaller/Epic/EpicStore.cs +++ b/CreamInstaller/Epic/EpicStore.cs @@ -15,18 +15,20 @@ namespace CreamInstaller.Epic; internal static class EpicStore { - // need a method to query catalog items + /* need a method to query catalog items + internal static async Task QueryCatalogItems(Manifest manifest) + { + }*/ internal static async Task> QueryEntitlements(Manifest manifest) { string @namespace = manifest.CatalogNamespace; - string mainId = manifest.MainGameCatalogItemId; List<(string id, string name, string product, string icon, string developer)> dlcIds = new(); Response response = await QueryGraphQL(@namespace); if (response is null) return dlcIds; try { File.WriteAllText(ProgramData.AppInfoPath + @$"\{@namespace}.json", JsonConvert.SerializeObject(response, Formatting.Indented)); } catch { } - List storeElements = new(response.Data.Catalog.SearchStore.Elements); - foreach (Element element in storeElements) + List searchStore = new(response.Data.Catalog.SearchStore.Elements); + foreach (Element element in searchStore) { string title = element.Title; string product = (element.CatalogNs is not null && element.CatalogNs.Mappings.Any()) @@ -44,8 +46,8 @@ internal static class EpicStore foreach (Item item in element.Items) dlcIds.Populate(item.Id, title, product, icon, null, canOverwrite: element.Items.Length == 1); } - List catalogElements = new(response.Data.Catalog.CatalogOffers.Elements); - foreach (Element element in catalogElements) + List catalogOffers = new(response.Data.Catalog.CatalogOffers.Elements); + foreach (Element element in catalogOffers) { string title = element.Title; string product = (element.CatalogNs is not null && element.CatalogNs.Mappings.Any()) diff --git a/CreamInstaller/Epic/GraphQL/Response.cs b/CreamInstaller/Epic/GraphQL/Response.cs index b4a6924..bb6bc0c 100644 --- a/CreamInstaller/Epic/GraphQL/Response.cs +++ b/CreamInstaller/Epic/GraphQL/Response.cs @@ -18,19 +18,13 @@ public class Data public class Catalog { [JsonProperty(PropertyName = "searchStore")] - public SearchStore SearchStore { get; protected set; } + public ElementContainer SearchStore { get; protected set; } [JsonProperty(PropertyName = "catalogOffers")] - public CatalogOffers CatalogOffers { get; protected set; } + public ElementContainer CatalogOffers { get; protected set; } } -public class SearchStore -{ - [JsonProperty(PropertyName = "elements")] - public Element[] Elements { get; protected set; } -} - -public class CatalogOffers +public class ElementContainer { [JsonProperty(PropertyName = "elements")] public Element[] Elements { get; protected set; }