final for now
This commit is contained in:
parent
8c8c007684
commit
c410cbdfd8
2 changed files with 11 additions and 15 deletions
|
@ -15,18 +15,20 @@ namespace CreamInstaller.Epic;
|
||||||
|
|
||||||
internal static class EpicStore
|
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<List<(string id, string name, string product, string icon, string developer)>> QueryEntitlements(Manifest manifest)
|
internal static async Task<List<(string id, string name, string product, string icon, string developer)>> QueryEntitlements(Manifest manifest)
|
||||||
{
|
{
|
||||||
string @namespace = manifest.CatalogNamespace;
|
string @namespace = manifest.CatalogNamespace;
|
||||||
string mainId = manifest.MainGameCatalogItemId;
|
|
||||||
List<(string id, string name, string product, string icon, string developer)> dlcIds = new();
|
List<(string id, string name, string product, string icon, string developer)> dlcIds = new();
|
||||||
Response response = await QueryGraphQL(@namespace);
|
Response response = await QueryGraphQL(@namespace);
|
||||||
if (response is null) return dlcIds;
|
if (response is null) return dlcIds;
|
||||||
try { File.WriteAllText(ProgramData.AppInfoPath + @$"\{@namespace}.json", JsonConvert.SerializeObject(response, Formatting.Indented)); } catch { }
|
try { File.WriteAllText(ProgramData.AppInfoPath + @$"\{@namespace}.json", JsonConvert.SerializeObject(response, Formatting.Indented)); } catch { }
|
||||||
List<Element> storeElements = new(response.Data.Catalog.SearchStore.Elements);
|
List<Element> searchStore = new(response.Data.Catalog.SearchStore.Elements);
|
||||||
foreach (Element element in storeElements)
|
foreach (Element element in searchStore)
|
||||||
{
|
{
|
||||||
string title = element.Title;
|
string title = element.Title;
|
||||||
string product = (element.CatalogNs is not null && element.CatalogNs.Mappings.Any())
|
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)
|
foreach (Item item in element.Items)
|
||||||
dlcIds.Populate(item.Id, title, product, icon, null, canOverwrite: element.Items.Length == 1);
|
dlcIds.Populate(item.Id, title, product, icon, null, canOverwrite: element.Items.Length == 1);
|
||||||
}
|
}
|
||||||
List<Element> catalogElements = new(response.Data.Catalog.CatalogOffers.Elements);
|
List<Element> catalogOffers = new(response.Data.Catalog.CatalogOffers.Elements);
|
||||||
foreach (Element element in catalogElements)
|
foreach (Element element in catalogOffers)
|
||||||
{
|
{
|
||||||
string title = element.Title;
|
string title = element.Title;
|
||||||
string product = (element.CatalogNs is not null && element.CatalogNs.Mappings.Any())
|
string product = (element.CatalogNs is not null && element.CatalogNs.Mappings.Any())
|
||||||
|
|
|
@ -18,19 +18,13 @@ public class Data
|
||||||
public class Catalog
|
public class Catalog
|
||||||
{
|
{
|
||||||
[JsonProperty(PropertyName = "searchStore")]
|
[JsonProperty(PropertyName = "searchStore")]
|
||||||
public SearchStore SearchStore { get; protected set; }
|
public ElementContainer SearchStore { get; protected set; }
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "catalogOffers")]
|
[JsonProperty(PropertyName = "catalogOffers")]
|
||||||
public CatalogOffers CatalogOffers { get; protected set; }
|
public ElementContainer CatalogOffers { get; protected set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SearchStore
|
public class ElementContainer
|
||||||
{
|
|
||||||
[JsonProperty(PropertyName = "elements")]
|
|
||||||
public Element[] Elements { get; protected set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CatalogOffers
|
|
||||||
{
|
{
|
||||||
[JsonProperty(PropertyName = "elements")]
|
[JsonProperty(PropertyName = "elements")]
|
||||||
public Element[] Elements { get; protected set; }
|
public Element[] Elements { get; protected set; }
|
||||||
|
|
Loading…
Reference in a new issue