WIP
This commit is contained in:
@@ -677,6 +677,14 @@ namespace gaseous_server.Classes
|
|||||||
|
|
||||||
public class MetadataAPI
|
public class MetadataAPI
|
||||||
{
|
{
|
||||||
|
public static string _HasheousClientAPIKey
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "Pna5SRcbJ6R8aasytab_6vZD0aBKDGNZKRz4WY4xArpfZ-3mdZq0hXIGyy0AD43b";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static HasheousClient.Models.MetadataModel.MetadataSources _MetadataSource
|
private static HasheousClient.Models.MetadataModel.MetadataSources _MetadataSource
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -749,6 +757,9 @@ namespace gaseous_server.Classes
|
|||||||
|
|
||||||
public string HasheousAPIKey = _HasheousAPIKey;
|
public string HasheousAPIKey = _HasheousAPIKey;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string HasheousClientAPIKey = _HasheousClientAPIKey;
|
||||||
|
|
||||||
public int MaxLibraryScanWorkers = _MaxLibraryScanWorkers;
|
public int MaxLibraryScanWorkers = _MaxLibraryScanWorkers;
|
||||||
|
|
||||||
public string HasheousHost = _HasheousHost;
|
public string HasheousHost = _HasheousHost;
|
||||||
|
@@ -197,7 +197,11 @@ namespace gaseous_server.Classes
|
|||||||
libraryRootPath += Path.DirectorySeparatorChar;
|
libraryRootPath += Path.DirectorySeparatorChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetLastThreeElements = (bool)row["DefaultLibrary"];
|
bool GetLastThreeElements = false;
|
||||||
|
if ((int)row["DefaultLibrary"] == 1)
|
||||||
|
{
|
||||||
|
GetLastThreeElements = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (DataRow romRow in romData.Rows)
|
foreach (DataRow romRow in romData.Rows)
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Buffers;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using IGDB;
|
using IGDB;
|
||||||
@@ -9,7 +10,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class AgeRatings
|
public class AgeRatings
|
||||||
{
|
{
|
||||||
const string fieldList = "fields category,checksum,content_descriptions,rating,rating_cover_url,synopsis;";
|
public const string fieldList = "fields category,checksum,content_descriptions,rating,rating_cover_url,synopsis;";
|
||||||
|
|
||||||
public AgeRatings()
|
public AgeRatings()
|
||||||
{
|
{
|
||||||
@@ -23,61 +24,33 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<AgeRating> RetVal = _GetAgeRatings(SearchUsing.id, Id);
|
Task<AgeRating> RetVal = _GetAgeRatings((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AgeRating GetAgeRatings(string Slug)
|
private static async Task<AgeRating> _GetAgeRatings(long searchValue)
|
||||||
{
|
|
||||||
Task<AgeRating> RetVal = _GetAgeRatings(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<AgeRating> _GetAgeRatings(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("AgeRating", (long)searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("AgeRating", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("AgeRating", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
AgeRating returnValue = new AgeRating();
|
AgeRating returnValue = new AgeRating();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
UpdateSubClasses(returnValue);
|
UpdateSubClasses(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<AgeRating>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<AgeRating>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -102,17 +75,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<AgeRating> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<AgeRating> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get AgeRatings metadata
|
// get AgeRatings metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<AgeRating>(IGDBClient.Endpoints.AgeRating, fieldList, WhereClause);
|
var results = await comms.APIComm<AgeRating>(Communications.MetadataEndpoint.AgeRating, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -157,7 +124,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
db.ExecuteNonQuery(sql);
|
db.ExecuteNonQuery(sql);
|
||||||
|
|
||||||
// loop all age groups
|
// loop all age groups
|
||||||
foreach(KeyValuePair<AgeGroups.AgeRestrictionGroupings, AgeGroups.AgeGroupItem> ageGrouping in AgeGroups.AgeGroupingsFlat)
|
foreach (KeyValuePair<AgeGroups.AgeRestrictionGroupings, AgeGroups.AgeGroupItem> ageGrouping in AgeGroups.AgeGroupingsFlat)
|
||||||
{
|
{
|
||||||
AgeGroups.AgeGroupItem ageGroupItem = ageGrouping.Value;
|
AgeGroups.AgeGroupItem ageGroupItem = ageGrouping.Value;
|
||||||
var properties = ageGroupItem.GetType().GetProperties();
|
var properties = ageGroupItem.GetType().GetProperties();
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class AgeRatingContentDescriptions
|
public class AgeRatingContentDescriptions
|
||||||
{
|
{
|
||||||
const string fieldList = "fields category,checksum,description;";
|
public const string fieldList = "fields category,checksum,description;";
|
||||||
|
|
||||||
public AgeRatingContentDescriptions()
|
public AgeRatingContentDescriptions()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<AgeRatingContentDescription> RetVal = _GetAgeRatingContentDescriptions(SearchUsing.id, Id);
|
Task<AgeRatingContentDescription> RetVal = _GetAgeRatingContentDescriptions((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AgeRatingContentDescription GetAgeRatingContentDescriptions(string Slug)
|
private static async Task<AgeRatingContentDescription> _GetAgeRatingContentDescriptions(long searchValue)
|
||||||
{
|
|
||||||
Task<AgeRatingContentDescription> RetVal = _GetAgeRatingContentDescriptions(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<AgeRatingContentDescription> _GetAgeRatingContentDescriptions(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("AgeRatingContentDescription", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("AgeRatingContentDescription", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("AgeRatingContentDescription", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
AgeRatingContentDescription returnValue = new AgeRatingContentDescription();
|
AgeRatingContentDescription returnValue = new AgeRatingContentDescription();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<AgeRatingContentDescription>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<AgeRatingContentDescription>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<AgeRatingContentDescription> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<AgeRatingContentDescription> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get AgeRatingContentDescriptionContentDescriptions metadata
|
// get AgeRatingContentDescriptionContentDescriptions metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<AgeRatingContentDescription>(IGDBClient.Endpoints.AgeRatingContentDescriptions, fieldList, WhereClause);
|
var results = await comms.APIComm<AgeRatingContentDescription>(Communications.MetadataEndpoint.AgeRatingContentDescription, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class AlternativeNames
|
public class AlternativeNames
|
||||||
{
|
{
|
||||||
const string fieldList = "fields checksum,comment,game,name;";
|
public const string fieldList = "fields checksum,comment,game,name;";
|
||||||
|
|
||||||
public AlternativeNames()
|
public AlternativeNames()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<AlternativeName> RetVal = _GetAlternativeNames(SearchUsing.id, Id);
|
Task<AlternativeName> RetVal = _GetAlternativeNames((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlternativeName GetAlternativeNames(string Slug)
|
private static async Task<AlternativeName> _GetAlternativeNames(long searchValue)
|
||||||
{
|
|
||||||
Task<AlternativeName> RetVal = _GetAlternativeNames(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<AlternativeName> _GetAlternativeNames(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("AlternativeName", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("AlternativeName", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("AlternativeName", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
AlternativeName returnValue = new AlternativeName();
|
AlternativeName returnValue = new AlternativeName();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<AlternativeName>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<AlternativeName>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<AlternativeName> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<AlternativeName> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get AlternativeNames metadata
|
// get AlternativeNames metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<AlternativeName>(IGDBClient.Endpoints.AlternativeNames, fieldList, WhereClause);
|
var results = await comms.APIComm<AlternativeName>(Communications.MetadataEndpoint.AlternativeName, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Artworks
|
public class Artworks
|
||||||
{
|
{
|
||||||
const string fieldList = "fields alpha_channel,animated,checksum,game,height,image_id,url,width;";
|
public const string fieldList = "fields alpha_channel,animated,checksum,game,height,image_id,url,width;";
|
||||||
|
|
||||||
public Artworks()
|
public Artworks()
|
||||||
{
|
{
|
||||||
@@ -21,43 +21,15 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Artwork> RetVal = _GetArtwork(SearchUsing.id, Id, ImagePath, GetImages);
|
Task<Artwork> RetVal = _GetArtwork((long)Id, ImagePath, GetImages);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Artwork GetArtwork(string Slug, string ImagePath, bool GetImages)
|
private static async Task<Artwork> _GetArtwork(long searchValue, string ImagePath, bool GetImages = true)
|
||||||
{
|
|
||||||
Task<Artwork> RetVal = _GetArtwork(SearchUsing.slug, Slug, ImagePath, GetImages);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Artwork> _GetArtwork(SearchUsing searchUsing, object searchValue, string ImagePath, bool GetImages = true)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("Artwork", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Artwork", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Artwork", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Artwork returnValue = new Artwork();
|
Artwork returnValue = new Artwork();
|
||||||
bool forceImageDownload = false;
|
bool forceImageDownload = false;
|
||||||
@@ -65,14 +37,14 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
forceImageDownload = true;
|
forceImageDownload = true;
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
|
|
||||||
// check if old value is different from the new value - only download if it's different
|
// check if old value is different from the new value - only download if it's different
|
||||||
@@ -84,7 +56,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<Artwork>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<Artwork>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -111,17 +83,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<Artwork> GetObjectFromServer(long searchValue, string ImagePath)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Artwork> GetObjectFromServer(string WhereClause, string ImagePath)
|
|
||||||
{
|
{
|
||||||
// get Artwork metadata
|
// get Artwork metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Artwork>(IGDBClient.Endpoints.Artworks, fieldList, WhereClause);
|
var results = await comms.APIComm<Artwork>(Communications.MetadataEndpoint.Artwork, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Collections
|
public class Collections
|
||||||
{
|
{
|
||||||
const string fieldList = "fields as_child_relations,as_parent_relations,checksum,created_at,games,name,slug,type,updated_at,url;";
|
public const string fieldList = "fields as_child_relations,as_parent_relations,checksum,created_at,games,name,slug,type,updated_at,url;";
|
||||||
|
|
||||||
public Collections()
|
public Collections()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Collection> RetVal = _GetCollections(SearchUsing.id, Id);
|
Task<Collection> RetVal = _GetCollections((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection GetCollections(string Slug)
|
private static async Task<Collection> _GetCollections(long searchValue)
|
||||||
{
|
|
||||||
Task<Collection> RetVal = _GetCollections(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Collection> _GetCollections(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("Collection", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Collection", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Collection", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Collection returnValue = new Collection();
|
Collection returnValue = new Collection();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<Collection>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<Collection>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<Collection> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Collection> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get Collections metadata
|
// get Collections metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Collection>(IGDBClient.Endpoints.Collections, fieldList, WhereClause);
|
var results = await comms.APIComm<Collection>(Communications.MetadataEndpoint.Collection, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -2,6 +2,8 @@ using System.ComponentModel;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Security.Policy;
|
||||||
|
using HasheousClient.Models.Metadata.IGDB;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using IGDB;
|
using IGDB;
|
||||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
@@ -24,12 +26,17 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
client.DefaultRequestHeaders.Add("Accept-Encoding", "deflate");
|
client.DefaultRequestHeaders.Add("Accept-Encoding", "deflate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// configure the IGDB client
|
||||||
private static IGDBClient igdb = new IGDBClient(
|
private static IGDBClient igdb = new IGDBClient(
|
||||||
// Found in Twitch Developer portal for your app
|
// Found in Twitch Developer portal for your app
|
||||||
Config.IGDB.ClientId,
|
Config.IGDB.ClientId,
|
||||||
Config.IGDB.Secret
|
Config.IGDB.Secret
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// provide the hasheous client
|
||||||
|
private static HasheousClient.Hasheous hasheous = new HasheousClient.Hasheous();
|
||||||
|
|
||||||
|
|
||||||
private static HttpClient client = new HttpClient();
|
private static HttpClient client = new HttpClient();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -57,6 +64,18 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
RateLimitRecoveryWaitTime = 10000;
|
RateLimitRecoveryWaitTime = 10000;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HasheousClient.Models.MetadataModel.MetadataSources.Hasheous:
|
||||||
|
// set rate limiter avoidance values
|
||||||
|
RateLimitAvoidanceWait = 1500;
|
||||||
|
RateLimitAvoidanceThreshold = 3;
|
||||||
|
RateLimitAvoidancePeriod = 1;
|
||||||
|
|
||||||
|
// set rate limiter recovery values
|
||||||
|
RateLimitRecoveryWaitTime = 10000;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// leave all values at default
|
// leave all values at default
|
||||||
break;
|
break;
|
||||||
@@ -159,8 +178,248 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
private int RetryAttempts = 0;
|
private int RetryAttempts = 0;
|
||||||
private int RetryAttemptsMax = 3;
|
private int RetryAttemptsMax = 3;
|
||||||
|
|
||||||
|
public enum MetadataEndpoint
|
||||||
|
{
|
||||||
|
AgeGroup,
|
||||||
|
AgeRating,
|
||||||
|
AgeRatingContentDescription,
|
||||||
|
AlternativeName,
|
||||||
|
Artwork,
|
||||||
|
Collection,
|
||||||
|
Company,
|
||||||
|
CompanyLogo,
|
||||||
|
Cover,
|
||||||
|
ExternalGame,
|
||||||
|
Franchise,
|
||||||
|
GameMode,
|
||||||
|
Game,
|
||||||
|
GameVideo,
|
||||||
|
Genre,
|
||||||
|
InvolvedCompany,
|
||||||
|
MultiplayerMode,
|
||||||
|
PlatformLogo,
|
||||||
|
Platform,
|
||||||
|
PlatformVersion,
|
||||||
|
PlayerPerspective,
|
||||||
|
ReleaseDate,
|
||||||
|
Search,
|
||||||
|
Screenshot,
|
||||||
|
Theme
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Request data from the metadata API
|
/// Request data from the metadata API using a slug
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">
|
||||||
|
/// The type of object to return
|
||||||
|
/// </typeparam>
|
||||||
|
/// <param name="Endpoint">
|
||||||
|
/// The endpoint to access - can only be either Platform or Game
|
||||||
|
/// </param>
|
||||||
|
/// <param name="Slug">
|
||||||
|
/// The slug to query for
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The object requested
|
||||||
|
/// </returns>
|
||||||
|
public async Task<T[]?> APIComm<T>(MetadataEndpoint Endpoint, string Slug)
|
||||||
|
{
|
||||||
|
switch (_MetadataSource)
|
||||||
|
{
|
||||||
|
case HasheousClient.Models.MetadataModel.MetadataSources.None:
|
||||||
|
return null;
|
||||||
|
case HasheousClient.Models.MetadataModel.MetadataSources.IGDB:
|
||||||
|
string fieldList = "";
|
||||||
|
string query = "where slug = \"" + Slug + "\"";
|
||||||
|
string EndpointString = "";
|
||||||
|
|
||||||
|
switch (Endpoint)
|
||||||
|
{
|
||||||
|
case MetadataEndpoint.Platform:
|
||||||
|
fieldList = Platforms.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Platforms;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Game:
|
||||||
|
fieldList = Games.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Games;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Exception("Endpoint must be either Platform or Game");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return await IGDBAPI<T>(EndpointString, fieldList, query);
|
||||||
|
|
||||||
|
case HasheousClient.Models.MetadataModel.MetadataSources.Hasheous:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request data from the metadata API using an id
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">
|
||||||
|
/// The type of object to return
|
||||||
|
/// </typeparam>
|
||||||
|
/// <param name="Endpoint">
|
||||||
|
/// The endpoint to access
|
||||||
|
/// </param>
|
||||||
|
/// <param name="Id">
|
||||||
|
/// The Id to query for
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The object requested
|
||||||
|
/// </returns>
|
||||||
|
public async Task<T[]> APIComm<T>(MetadataEndpoint Endpoint, long Id)
|
||||||
|
{
|
||||||
|
switch (_MetadataSource)
|
||||||
|
{
|
||||||
|
case HasheousClient.Models.MetadataModel.MetadataSources.None:
|
||||||
|
return null;
|
||||||
|
case HasheousClient.Models.MetadataModel.MetadataSources.IGDB:
|
||||||
|
string fieldList = "";
|
||||||
|
string query = "where id = " + Id;
|
||||||
|
string EndpointString = "";
|
||||||
|
|
||||||
|
switch (Endpoint)
|
||||||
|
{
|
||||||
|
case MetadataEndpoint.AgeRating:
|
||||||
|
fieldList = AgeRatings.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.AgeRating;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.AgeRatingContentDescription:
|
||||||
|
fieldList = AgeRatingContentDescriptions.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.AgeRatingContentDescriptions;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.AlternativeName:
|
||||||
|
fieldList = AlternativeNames.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.AlternativeNames;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Artwork:
|
||||||
|
fieldList = Artworks.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Artworks;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Collection:
|
||||||
|
fieldList = Collections.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Collections;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Company:
|
||||||
|
fieldList = Companies.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Companies;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.CompanyLogo:
|
||||||
|
fieldList = CompanyLogos.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.CompanyLogos;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Cover:
|
||||||
|
fieldList = Covers.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Covers;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.ExternalGame:
|
||||||
|
fieldList = ExternalGames.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.ExternalGames;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Franchise:
|
||||||
|
fieldList = Franchises.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Franchies;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.GameMode:
|
||||||
|
fieldList = GameModes.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.GameModes;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Game:
|
||||||
|
fieldList = Games.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Games;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.GameVideo:
|
||||||
|
fieldList = GamesVideos.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.GameVideos;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Genre:
|
||||||
|
fieldList = Genres.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Genres;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.InvolvedCompany:
|
||||||
|
fieldList = InvolvedCompanies.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.InvolvedCompanies;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.MultiplayerMode:
|
||||||
|
fieldList = MultiplayerModes.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.MultiplayerModes;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.PlatformLogo:
|
||||||
|
fieldList = PlatformLogos.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.PlatformLogos;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Platform:
|
||||||
|
fieldList = Platforms.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Platforms;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.PlatformVersion:
|
||||||
|
fieldList = PlatformVersions.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.PlatformVersions;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.PlayerPerspective:
|
||||||
|
fieldList = PlayerPerspectives.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.PlayerPerspectives;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.ReleaseDate:
|
||||||
|
fieldList = ReleaseDates.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.ReleaseDates;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Screenshot:
|
||||||
|
fieldList = Screenshots.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Screenshots;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MetadataEndpoint.Theme:
|
||||||
|
fieldList = Themes.fieldList;
|
||||||
|
EndpointString = IGDBClient.Endpoints.Themes;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Exception("Endpoint must be either Platform or Game");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return await IGDBAPI<T>(EndpointString, fieldList, query);
|
||||||
|
|
||||||
|
case HasheousClient.Models.MetadataModel.MetadataSources.Hasheous:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request data from the metadata API - this is only valid for IGDB
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">Type of object to return</typeparam>
|
/// <typeparam name="T">Type of object to return</typeparam>
|
||||||
/// <param name="Endpoint">API endpoint segment to use</param>
|
/// <param name="Endpoint">API endpoint segment to use</param>
|
||||||
@@ -175,6 +434,33 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return null;
|
return null;
|
||||||
case HasheousClient.Models.MetadataModel.MetadataSources.IGDB:
|
case HasheousClient.Models.MetadataModel.MetadataSources.IGDB:
|
||||||
return await IGDBAPI<T>(Endpoint, Fields, Query);
|
return await IGDBAPI<T>(Endpoint, Fields, Query);
|
||||||
|
case HasheousClient.Models.MetadataModel.MetadataSources.Hasheous:
|
||||||
|
// configure the Hasheous client
|
||||||
|
hasheous = new HasheousClient.Hasheous();
|
||||||
|
|
||||||
|
// set the base URI
|
||||||
|
string HasheousHost = "";
|
||||||
|
if (Config.MetadataConfiguration.HasheousHost == null)
|
||||||
|
{
|
||||||
|
HasheousHost = "https://hasheous.org/";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HasheousHost = Config.MetadataConfiguration.HasheousHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the client API key
|
||||||
|
HasheousClient.WebApp.HttpHelper.ClientKey = Config.MetadataConfiguration.HasheousClientAPIKey;
|
||||||
|
|
||||||
|
// set the client secret
|
||||||
|
if (Config.MetadataConfiguration.HasheousAPIKey != null)
|
||||||
|
{
|
||||||
|
HasheousClient.WebApp.HttpHelper.APIKey = Config.MetadataConfiguration.HasheousAPIKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return from Hasheous
|
||||||
|
return await HasheousAPI<T>(Endpoint, Fields, Query);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -200,7 +486,8 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
|
|
||||||
// perform the actual API call
|
// perform the actual API call
|
||||||
var results = await igdb.QueryAsync<T>(Endpoint, query: Fields + " " + Query + ";");
|
string queryString = Fields + " " + Query + ";";
|
||||||
|
var results = await igdb.QueryAsync<T>(Endpoint, query: queryString);
|
||||||
|
|
||||||
// increment rate limiter avoidance call count
|
// increment rate limiter avoidance call count
|
||||||
RateLimitAvoidanceCallCount += 1;
|
RateLimitAvoidanceCallCount += 1;
|
||||||
@@ -253,6 +540,145 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Access the HasheousAPI
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">
|
||||||
|
/// The type of object to return
|
||||||
|
/// </typeparam>
|
||||||
|
/// <param name="Endpoint">
|
||||||
|
/// The endpoint to access
|
||||||
|
/// </param>
|
||||||
|
/// <param name="Fields">
|
||||||
|
/// Can be either "slug" or "id" - note not all endpoints support slug
|
||||||
|
/// </param>
|
||||||
|
/// <param name="Query">
|
||||||
|
/// The "slug" or "id" to query for
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The object requested
|
||||||
|
/// </returns>
|
||||||
|
private async Task<T[]> HasheousAPI<T>(string Endpoint, string Fields, string Query)
|
||||||
|
{
|
||||||
|
Logging.Log(Logging.LogType.Debug, "API Connection", "Accessing API for endpoint: " + Endpoint);
|
||||||
|
|
||||||
|
if (RateLimitResumeTime > DateTime.UtcNow)
|
||||||
|
{
|
||||||
|
Logging.Log(Logging.LogType.Information, "API Connection", "IGDB rate limit hit. Pausing API communications until " + RateLimitResumeTime.ToString() + ". Attempt " + RetryAttempts + " of " + RetryAttemptsMax + " retries.");
|
||||||
|
Thread.Sleep(RateLimitRecoveryWaitTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (InRateLimitAvoidanceMode == true)
|
||||||
|
{
|
||||||
|
// sleep for a moment to help avoid hitting the rate limiter
|
||||||
|
Logging.Log(Logging.LogType.Information, "API Connection: Endpoint:" + Endpoint, "IGDB rate limit hit. Pausing API communications for " + RateLimitAvoidanceWait + " milliseconds to avoid rate limiter.");
|
||||||
|
Thread.Sleep(RateLimitAvoidanceWait);
|
||||||
|
}
|
||||||
|
|
||||||
|
// perform the actual API call
|
||||||
|
//var results = await igdb.QueryAsync<T>(Endpoint, query: Fields + " " + Query + ";");
|
||||||
|
|
||||||
|
T result1;
|
||||||
|
if (Fields == "slug")
|
||||||
|
{
|
||||||
|
result1 = hasheous.GetMetadataProxy<T>(HasheousClient.Hasheous.MetadataProvider.IGDB, Query);
|
||||||
|
}
|
||||||
|
else if (Fields == "id")
|
||||||
|
{
|
||||||
|
result1 = hasheous.GetMetadataProxy<T>(HasheousClient.Hasheous.MetadataProvider.IGDB, Query);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Fields must be either 'slug' or 'id'");
|
||||||
|
}
|
||||||
|
|
||||||
|
var results1 = new T[] { result1 };
|
||||||
|
|
||||||
|
// increment rate limiter avoidance call count
|
||||||
|
RateLimitAvoidanceCallCount += 1;
|
||||||
|
|
||||||
|
return results1;
|
||||||
|
}
|
||||||
|
catch (ApiException apiEx)
|
||||||
|
{
|
||||||
|
switch (apiEx.StatusCode)
|
||||||
|
{
|
||||||
|
case HttpStatusCode.TooManyRequests:
|
||||||
|
if (RetryAttempts >= RetryAttemptsMax)
|
||||||
|
{
|
||||||
|
Logging.Log(Logging.LogType.Warning, "API Connection", "IGDB rate limiter attempts expired. Aborting.", apiEx);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logging.Log(Logging.LogType.Information, "API Connection", "IGDB API rate limit hit while accessing endpoint " + Endpoint, apiEx);
|
||||||
|
|
||||||
|
RetryAttempts += 1;
|
||||||
|
|
||||||
|
T result2;
|
||||||
|
if (Fields == "slug")
|
||||||
|
{
|
||||||
|
result2 = hasheous.GetMetadataProxy<T>(HasheousClient.Hasheous.MetadataProvider.IGDB, Query);
|
||||||
|
}
|
||||||
|
else if (Fields == "id")
|
||||||
|
{
|
||||||
|
result2 = hasheous.GetMetadataProxy<T>(HasheousClient.Hasheous.MetadataProvider.IGDB, Query);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Fields must be either 'slug' or 'id'");
|
||||||
|
}
|
||||||
|
|
||||||
|
var results2 = new T[] { result2 };
|
||||||
|
|
||||||
|
return results2;
|
||||||
|
}
|
||||||
|
|
||||||
|
case HttpStatusCode.Unauthorized:
|
||||||
|
Logging.Log(Logging.LogType.Information, "API Connection", "IGDB API unauthorised error while accessing endpoint " + Endpoint + ". Waiting " + RateLimitAvoidanceWait + " milliseconds and resetting IGDB client.", apiEx);
|
||||||
|
|
||||||
|
Thread.Sleep(RateLimitAvoidanceWait);
|
||||||
|
|
||||||
|
igdb = new IGDBClient(
|
||||||
|
// Found in Twitch Developer portal for your app
|
||||||
|
Config.IGDB.ClientId,
|
||||||
|
Config.IGDB.Secret
|
||||||
|
);
|
||||||
|
|
||||||
|
RetryAttempts += 1;
|
||||||
|
|
||||||
|
T result3;
|
||||||
|
if (Fields == "slug")
|
||||||
|
{
|
||||||
|
result3 = hasheous.GetMetadataProxy<T>(HasheousClient.Hasheous.MetadataProvider.IGDB, Query);
|
||||||
|
}
|
||||||
|
else if (Fields == "id")
|
||||||
|
{
|
||||||
|
result3 = hasheous.GetMetadataProxy<T>(HasheousClient.Hasheous.MetadataProvider.IGDB, Query);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Fields must be either 'slug' or 'id'");
|
||||||
|
}
|
||||||
|
|
||||||
|
var results3 = new T[] { result3 };
|
||||||
|
|
||||||
|
return results3;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Logging.Log(Logging.LogType.Warning, "API Connection", "Exception when accessing endpoint " + Endpoint, apiEx);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.Log(Logging.LogType.Warning, "API Connection", "Exception when accessing endpoint " + Endpoint, ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Download from the specified uri
|
/// Download from the specified uri
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -6,7 +6,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Companies
|
public class Companies
|
||||||
{
|
{
|
||||||
const string fieldList = "fields change_date,change_date_category,changed_company_id,checksum,country,created_at,description,developed,logo,name,parent,published,slug,start_date,start_date_category,updated_at,url,websites;";
|
public const string fieldList = "fields change_date,change_date_category,changed_company_id,checksum,country,created_at,description,developed,logo,name,parent,published,slug,start_date,start_date_category,updated_at,url,websites;";
|
||||||
|
|
||||||
public Companies()
|
public Companies()
|
||||||
{
|
{
|
||||||
@@ -20,61 +20,33 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Company> RetVal = _GetCompanies(SearchUsing.id, Id);
|
Task<Company> RetVal = _GetCompanies((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Company GetCompanies(string Slug)
|
private static async Task<Company> _GetCompanies(long searchValue)
|
||||||
{
|
|
||||||
Task<Company> RetVal = _GetCompanies(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Company> _GetCompanies(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("Company", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Company", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Company", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Company returnValue = new Company();
|
Company returnValue = new Company();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
if (returnValue != null) { Storage.NewCacheValue(returnValue); }
|
if (returnValue != null) { Storage.NewCacheValue(returnValue); }
|
||||||
UpdateSubClasses(returnValue);
|
UpdateSubClasses(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<Company>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<Company>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -96,17 +68,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<Company> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Company> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get Companies metadata
|
// get Companies metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Company>(IGDBClient.Endpoints.Companies, fieldList, WhereClause);
|
var results = await comms.APIComm<Company>(Communications.MetadataEndpoint.Company, searchValue);
|
||||||
if (results.Length > 0)
|
if (results.Length > 0)
|
||||||
{
|
{
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class CompanyLogos
|
public class CompanyLogos
|
||||||
{
|
{
|
||||||
const string fieldList = "fields alpha_channel,animated,checksum,height,image_id,url,width;";
|
public const string fieldList = "fields alpha_channel,animated,checksum,height,image_id,url,width;";
|
||||||
|
|
||||||
public CompanyLogos()
|
public CompanyLogos()
|
||||||
{
|
{
|
||||||
@@ -21,50 +21,22 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<CompanyLogo> RetVal = _GetCompanyLogo(SearchUsing.id, Id, ImagePath);
|
Task<CompanyLogo> RetVal = _GetCompanyLogo((long)Id, ImagePath);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompanyLogo GetCompanyLogo(string Slug, string ImagePath)
|
private static async Task<CompanyLogo> _GetCompanyLogo(long searchValue, string ImagePath)
|
||||||
{
|
|
||||||
Task<CompanyLogo> RetVal = _GetCompanyLogo(SearchUsing.slug, Slug, ImagePath);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<CompanyLogo> _GetCompanyLogo(SearchUsing searchUsing, object searchValue, string ImagePath)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("CompanyLogo", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("CompanyLogo", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("CompanyLogo", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
CompanyLogo returnValue = new CompanyLogo();
|
CompanyLogo returnValue = new CompanyLogo();
|
||||||
bool forceImageDownload = false;
|
bool forceImageDownload = false;
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
if (returnValue != null)
|
if (returnValue != null)
|
||||||
{
|
{
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
@@ -74,7 +46,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
|
|
||||||
// check if old value is different from the new value - only download if it's different
|
// check if old value is different from the new value - only download if it's different
|
||||||
@@ -86,7 +58,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<CompanyLogo>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<CompanyLogo>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -110,17 +82,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<CompanyLogo> GetObjectFromServer(long searchValue, string ImagePath)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<CompanyLogo> GetObjectFromServer(string WhereClause, string ImagePath)
|
|
||||||
{
|
{
|
||||||
// get Artwork metadata
|
// get Artwork metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<CompanyLogo>(IGDBClient.Endpoints.CompanyLogos, fieldList, WhereClause);
|
var results = await comms.APIComm<CompanyLogo>(Communications.MetadataEndpoint.CompanyLogo, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -9,7 +9,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Covers
|
public class Covers
|
||||||
{
|
{
|
||||||
const string fieldList = "fields alpha_channel,animated,checksum,game,game_localization,height,image_id,url,width;";
|
public const string fieldList = "fields alpha_channel,animated,checksum,game,game_localization,height,image_id,url,width;";
|
||||||
|
|
||||||
public Covers()
|
public Covers()
|
||||||
{
|
{
|
||||||
@@ -23,43 +23,15 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Cover> RetVal = _GetCover(SearchUsing.id, Id, ImagePath, GetImages);
|
Task<Cover> RetVal = _GetCover((long)Id, ImagePath, GetImages);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Cover GetCover(string Slug, string ImagePath, bool GetImages)
|
private static async Task<Cover> _GetCover(long searchValue, string ImagePath, bool GetImages = true)
|
||||||
{
|
|
||||||
Task<Cover> RetVal = _GetCover(SearchUsing.slug, Slug, ImagePath, GetImages);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Cover> _GetCover(SearchUsing searchUsing, object searchValue, string ImagePath, bool GetImages = true)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("Cover", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Cover", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Cover", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Cover returnValue = new Cover();
|
Cover returnValue = new Cover();
|
||||||
bool forceImageDownload = false;
|
bool forceImageDownload = false;
|
||||||
@@ -67,14 +39,14 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
forceImageDownload = true;
|
forceImageDownload = true;
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
|
|
||||||
// check if old value is different from the new value - only download if it's different
|
// check if old value is different from the new value - only download if it's different
|
||||||
@@ -86,7 +58,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<Cover>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<Cover>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -126,17 +98,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<Cover> GetObjectFromServer(long searchValue, string ImagePath)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Cover> GetObjectFromServer(string WhereClause, string ImagePath)
|
|
||||||
{
|
{
|
||||||
// get Cover metadata
|
// get Cover metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Cover>(IGDBClient.Endpoints.Covers, fieldList, WhereClause);
|
var results = await comms.APIComm<Cover>(Communications.MetadataEndpoint.Cover, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class ExternalGames
|
public class ExternalGames
|
||||||
{
|
{
|
||||||
const string fieldList = "fields category,checksum,countries,created_at,game,media,name,platform,uid,updated_at,url,year;";
|
public const string fieldList = "fields category,checksum,countries,created_at,game,media,name,platform,uid,updated_at,url,year;";
|
||||||
|
|
||||||
public ExternalGames()
|
public ExternalGames()
|
||||||
{
|
{
|
||||||
@@ -21,49 +21,21 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<ExternalGame> RetVal = _GetExternalGames(SearchUsing.id, Id);
|
Task<ExternalGame> RetVal = _GetExternalGames((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ExternalGame GetExternalGames(string Slug)
|
private static async Task<ExternalGame> _GetExternalGames(long searchValue)
|
||||||
{
|
|
||||||
Task<ExternalGame> RetVal = _GetExternalGames(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<ExternalGame> _GetExternalGames(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("ExternalGame", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("ExternalGame", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("ExternalGame", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
ExternalGame returnValue = new ExternalGame();
|
ExternalGame returnValue = new ExternalGame();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
if (returnValue != null)
|
if (returnValue != null)
|
||||||
{
|
{
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
@@ -72,12 +44,12 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<ExternalGame>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<ExternalGame>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -91,17 +63,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<ExternalGame?> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<ExternalGame?> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get ExternalGames metadata
|
// get ExternalGames metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<ExternalGame>(IGDBClient.Endpoints.ExternalGames, fieldList, WhereClause);
|
var results = await comms.APIComm<ExternalGame>(Communications.MetadataEndpoint.ExternalGame, searchValue);
|
||||||
if (results.Length > 0)
|
if (results.Length > 0)
|
||||||
{
|
{
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Franchises
|
public class Franchises
|
||||||
{
|
{
|
||||||
const string fieldList = "fields checksum,created_at,games,name,slug,updated_at,url;";
|
public const string fieldList = "fields checksum,created_at,games,name,slug,updated_at,url;";
|
||||||
|
|
||||||
public Franchises()
|
public Franchises()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Franchise> RetVal = _GetFranchises(SearchUsing.id, Id);
|
Task<Franchise> RetVal = _GetFranchises((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Franchise GetFranchises(string Slug)
|
private static async Task<Franchise> _GetFranchises(long searchValue)
|
||||||
{
|
|
||||||
Task<Franchise> RetVal = _GetFranchises(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Franchise> _GetFranchises(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("Franchise", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Franchise", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Franchise", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Franchise returnValue = new Franchise();
|
Franchise returnValue = new Franchise();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<Franchise>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<Franchise>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<Franchise> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Franchise> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get FranchiseContentDescriptions metadata
|
// get FranchiseContentDescriptions metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Franchise>(IGDBClient.Endpoints.Franchies, fieldList, WhereClause);
|
var results = await comms.APIComm<Franchise>(Communications.MetadataEndpoint.Franchise, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class GameModes
|
public class GameModes
|
||||||
{
|
{
|
||||||
const string fieldList = "fields checksum,created_at,name,slug,updated_at,url;";
|
public const string fieldList = "fields checksum,created_at,name,slug,updated_at,url;";
|
||||||
|
|
||||||
public GameModes()
|
public GameModes()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<GameMode> RetVal = _GetGame_Modes(SearchUsing.id, Id);
|
Task<GameMode> RetVal = _GetGame_Modes((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameMode GetGame_Modes(string Slug)
|
private static async Task<GameMode> _GetGame_Modes(long searchValue)
|
||||||
{
|
|
||||||
Task<GameMode> RetVal = _GetGame_Modes(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<GameMode> _GetGame_Modes(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("GameMode", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("GameMode", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("GameMode", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
GameMode returnValue = new GameMode();
|
GameMode returnValue = new GameMode();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<GameMode>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<GameMode>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<GameMode> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<GameMode> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get Game_Modes metadata
|
// get Game_Modes metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<GameMode>(IGDBClient.Endpoints.GameModes, fieldList, WhereClause);
|
var results = await comms.APIComm<GameMode>(Communications.MetadataEndpoint.GameMode, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class GamesVideos
|
public class GamesVideos
|
||||||
{
|
{
|
||||||
const string fieldList = "fields checksum,game,name,video_id;";
|
public const string fieldList = "fields checksum,game,name,video_id;";
|
||||||
|
|
||||||
public GamesVideos()
|
public GamesVideos()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<GameVideo> RetVal = _GetGame_Videos(SearchUsing.id, Id);
|
Task<GameVideo> RetVal = _GetGame_Videos((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameVideo GetGame_Videos(string Slug)
|
private static async Task<GameVideo> _GetGame_Videos(long searchValue)
|
||||||
{
|
|
||||||
Task<GameVideo> RetVal = _GetGame_Videos(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<GameVideo> _GetGame_Videos(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("GameVideo", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("GameVideo", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("GameVideo", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
GameVideo returnValue = new GameVideo();
|
GameVideo returnValue = new GameVideo();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<GameVideo>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<GameVideo>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<GameVideo> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<GameVideo> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get Game_Videos metadata
|
// get Game_Videos metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<GameVideo>(IGDBClient.Endpoints.GameVideos, fieldList, WhereClause);
|
var results = await comms.APIComm<GameVideo>(Communications.MetadataEndpoint.GameVideo, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -8,7 +8,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Games
|
public class Games
|
||||||
{
|
{
|
||||||
const string fieldList = "fields age_ratings,aggregated_rating,aggregated_rating_count,alternative_names,artworks,bundles,category,checksum,collections,cover,created_at,dlcs,expanded_games,expansions,external_games,first_release_date,follows,forks,franchise,franchises,game_engines,game_localizations,game_modes,genres,hypes,involved_companies,keywords,language_supports,multiplayer_modes,name,parent_game,platforms,player_perspectives,ports,rating,rating_count,release_dates,remakes,remasters,screenshots,similar_games,slug,standalone_expansions,status,storyline,summary,tags,themes,total_rating,total_rating_count,updated_at,url,version_parent,version_title,videos,websites;";
|
public const string fieldList = "fields age_ratings,aggregated_rating,aggregated_rating_count,alternative_names,artworks,bundles,category,checksum,collections,cover,created_at,dlcs,expanded_games,expansions,external_games,first_release_date,follows,forks,franchise,franchises,game_engines,game_localizations,game_modes,genres,hypes,involved_companies,keywords,language_supports,multiplayer_modes,name,parent_game,platforms,player_perspectives,ports,rating,rating_count,release_dates,remakes,remasters,screenshots,similar_games,slug,standalone_expansions,status,storyline,summary,tags,themes,total_rating,total_rating_count,updated_at,url,version_parent,version_title,videos,websites;";
|
||||||
|
|
||||||
public Games()
|
public Games()
|
||||||
{
|
{
|
||||||
@@ -45,14 +45,14 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Game> RetVal = _GetGame(SearchUsing.id, Id, getAllMetadata, followSubGames, forceRefresh);
|
Task<Game> RetVal = _GetGame(SearchUsing.Id, Id, getAllMetadata, followSubGames, forceRefresh);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Game GetGame(string Slug, bool getAllMetadata, bool followSubGames, bool forceRefresh)
|
public static Game GetGame(string Slug, bool getAllMetadata, bool followSubGames, bool forceRefresh)
|
||||||
{
|
{
|
||||||
Task<Game> RetVal = _GetGame(SearchUsing.slug, Slug, getAllMetadata, followSubGames, forceRefresh);
|
Task<Game> RetVal = _GetGame(SearchUsing.Slug, Slug, getAllMetadata, followSubGames, forceRefresh);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
||||||
if (searchUsing == SearchUsing.id)
|
if (searchUsing == SearchUsing.Id)
|
||||||
{
|
{
|
||||||
cacheStatus = Storage.GetCacheStatus("Game", (long)searchValue);
|
cacheStatus = Storage.GetCacheStatus("Game", (long)searchValue);
|
||||||
}
|
}
|
||||||
@@ -79,45 +79,43 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
if (cacheStatus == Storage.CacheStatus.Current) { cacheStatus = Storage.CacheStatus.Expired; }
|
if (cacheStatus == Storage.CacheStatus.Current) { cacheStatus = Storage.CacheStatus.Expired; }
|
||||||
}
|
}
|
||||||
|
|
||||||
string WhereClause = "";
|
|
||||||
string searchField = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
searchField = "id";
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = \"" + searchValue + "\"";
|
|
||||||
searchField = "slug";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Game returnValue = new Game();
|
Game returnValue = new Game();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
if (searchUsing == SearchUsing.Id)
|
||||||
|
{
|
||||||
|
returnValue = await GetObjectFromServer((long)searchValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = await GetObjectFromServer((string)searchValue);
|
||||||
|
}
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
UpdateSubClasses(returnValue, getAllMetadata, followSubGames, forceRefresh);
|
UpdateSubClasses(returnValue, getAllMetadata, followSubGames, forceRefresh);
|
||||||
return returnValue;
|
return returnValue;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
if (searchUsing == SearchUsing.Id)
|
||||||
|
{
|
||||||
|
returnValue = await GetObjectFromServer((long)searchValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = await GetObjectFromServer((string)searchValue);
|
||||||
|
}
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
UpdateSubClasses(returnValue, getAllMetadata, followSubGames, forceRefresh);
|
UpdateSubClasses(returnValue, getAllMetadata, followSubGames, forceRefresh);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id/Slug: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<Game>(returnValue, searchField, searchValue);
|
returnValue = Storage.GetCacheValue<Game>(returnValue, searchUsing.ToString(), searchValue);
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
case Storage.CacheStatus.Current:
|
case Storage.CacheStatus.Current:
|
||||||
returnValue = Storage.GetCacheValue<Game>(returnValue, searchField, searchValue);
|
returnValue = Storage.GetCacheValue<Game>(returnValue, searchUsing.ToString(), searchValue);
|
||||||
UpdateSubClasses(returnValue, false, false, false);
|
UpdateSubClasses(returnValue, false, false, false);
|
||||||
return returnValue;
|
return returnValue;
|
||||||
default:
|
default:
|
||||||
@@ -309,17 +307,36 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
|
|
||||||
private enum SearchUsing
|
private enum SearchUsing
|
||||||
{
|
{
|
||||||
id,
|
Id,
|
||||||
slug
|
Slug
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<Game> GetObjectFromServer(string WhereClause)
|
private static async Task<Game> GetObjectFromServer(string Slug)
|
||||||
{
|
{
|
||||||
// get Game metadata
|
// get Game metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Game>(IGDBClient.Endpoints.Games, fieldList, WhereClause);
|
var results = await comms.APIComm<Game>(Communications.MetadataEndpoint.Game, Slug);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
|
result = MassageResult(result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task<Game> GetObjectFromServer(long Id)
|
||||||
|
{
|
||||||
|
// get Game metadata
|
||||||
|
Communications comms = new Communications();
|
||||||
|
var results = await comms.APIComm<Game>(Communications.MetadataEndpoint.Game, Id);
|
||||||
|
var result = results.First();
|
||||||
|
|
||||||
|
result = MassageResult(result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Game MassageResult(Game result)
|
||||||
|
{
|
||||||
// add artificial unknown platform mapping
|
// add artificial unknown platform mapping
|
||||||
List<long> platformIds = new List<long>();
|
List<long> platformIds = new List<long>();
|
||||||
platformIds.Add(0);
|
platformIds.Add(0);
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Genres
|
public class Genres
|
||||||
{
|
{
|
||||||
const string fieldList = "fields checksum,created_at,name,slug,updated_at,url;";
|
public const string fieldList = "fields checksum,created_at,name,slug,updated_at,url;";
|
||||||
|
|
||||||
public Genres()
|
public Genres()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Genre> RetVal = _GetGenres(SearchUsing.id, Id);
|
Task<Genre> RetVal = _GetGenres((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Genre GetGenres(string Slug)
|
private static async Task<Genre> _GetGenres(long searchValue)
|
||||||
{
|
|
||||||
Task<Genre> RetVal = _GetGenres(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Genre> _GetGenres(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("Genre", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Genre", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Genre", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Genre returnValue = new Genre();
|
Genre returnValue = new Genre();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<Genre>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<Genre>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<Genre> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Genre> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get Genres metadata
|
// get Genres metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Genre>(IGDBClient.Endpoints.Genres, fieldList, WhereClause);
|
var results = await comms.APIComm<Genre>(Communications.MetadataEndpoint.Genre, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -6,7 +6,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class InvolvedCompanies
|
public class InvolvedCompanies
|
||||||
{
|
{
|
||||||
const string fieldList = "fields *;";
|
public const string fieldList = "fields *;";
|
||||||
|
|
||||||
public InvolvedCompanies()
|
public InvolvedCompanies()
|
||||||
{
|
{
|
||||||
@@ -20,61 +20,33 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<InvolvedCompany> RetVal = _GetInvolvedCompanies(SearchUsing.id, Id);
|
Task<InvolvedCompany> RetVal = _GetInvolvedCompanies((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InvolvedCompany GetInvolvedCompanies(string Slug)
|
private static async Task<InvolvedCompany> _GetInvolvedCompanies(long searchValue)
|
||||||
{
|
|
||||||
Task<InvolvedCompany> RetVal = _GetInvolvedCompanies(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<InvolvedCompany> _GetInvolvedCompanies(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("InvolvedCompany", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("InvolvedCompany", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("InvolvedCompany", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
InvolvedCompany returnValue = new InvolvedCompany();
|
InvolvedCompany returnValue = new InvolvedCompany();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
UpdateSubClasses(returnValue);
|
UpdateSubClasses(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<InvolvedCompany>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<InvolvedCompany>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -96,32 +68,15 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<InvolvedCompany> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<InvolvedCompany> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
|
||||||
// get InvolvedCompanies metadata
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
|
// get Genres metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<InvolvedCompany>(IGDBClient.Endpoints.InvolvedCompanies, fieldList, WhereClause);
|
var results = await comms.APIComm<InvolvedCompany>(Communications.MetadataEndpoint.InvolvedCompany, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logging.Log(Logging.LogType.Critical, "Involved Companies", "Failure when requesting involved companies.");
|
|
||||||
Logging.Log(Logging.LogType.Critical, "Involved Companies", "Field list: " + fieldList);
|
|
||||||
Logging.Log(Logging.LogType.Critical, "Involved Companies", "Where clause: " + WhereClause);
|
|
||||||
Logging.Log(Logging.LogType.Critical, "Involved Companies", "Error", ex);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class MultiplayerModes
|
public class MultiplayerModes
|
||||||
{
|
{
|
||||||
const string fieldList = "fields campaigncoop,checksum,dropin,game,lancoop,offlinecoop,offlinecoopmax,offlinemax,onlinecoop,onlinecoopmax,onlinemax,platform,splitscreen,splitscreenonline;";
|
public const string fieldList = "fields campaigncoop,checksum,dropin,game,lancoop,offlinecoop,offlinecoopmax,offlinemax,onlinecoop,onlinecoopmax,onlinemax,platform,splitscreen,splitscreenonline;";
|
||||||
|
|
||||||
public MultiplayerModes()
|
public MultiplayerModes()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<MultiplayerMode> RetVal = _GetGame_MultiplayerModes(SearchUsing.id, Id);
|
Task<MultiplayerMode> RetVal = _GetGame_MultiplayerModes((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MultiplayerMode GetGame_MultiplayerModes(string Slug)
|
private static async Task<MultiplayerMode> _GetGame_MultiplayerModes(long searchValue)
|
||||||
{
|
|
||||||
Task<MultiplayerMode> RetVal = _GetGame_MultiplayerModes(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<MultiplayerMode> _GetGame_MultiplayerModes(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("MultiplayerMode", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("MultiplayerMode", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("MultiplayerMode", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiplayerMode returnValue = new MultiplayerMode();
|
MultiplayerMode returnValue = new MultiplayerMode();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<MultiplayerMode>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<MultiplayerMode>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<MultiplayerMode> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<MultiplayerMode> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get Game_MultiplayerModes metadata
|
// get Game_MultiplayerModes metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<MultiplayerMode>(IGDBClient.Endpoints.MultiplayerModes, fieldList, WhereClause);
|
var results = await comms.APIComm<MultiplayerMode>(Communications.MetadataEndpoint.MultiplayerMode, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class PlatformLogos
|
public class PlatformLogos
|
||||||
{
|
{
|
||||||
const string fieldList = "fields alpha_channel,animated,checksum,height,image_id,url,width;";
|
public const string fieldList = "fields alpha_channel,animated,checksum,height,image_id,url,width;";
|
||||||
|
|
||||||
public PlatformLogos()
|
public PlatformLogos()
|
||||||
{
|
{
|
||||||
@@ -21,50 +21,22 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<PlatformLogo> RetVal = _GetPlatformLogo(SearchUsing.id, Id, ImagePath);
|
Task<PlatformLogo> RetVal = _GetPlatformLogo((long)Id, ImagePath);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlatformLogo GetPlatformLogo(string Slug, string ImagePath)
|
private static async Task<PlatformLogo> _GetPlatformLogo(long searchValue, string ImagePath)
|
||||||
{
|
|
||||||
Task<PlatformLogo> RetVal = _GetPlatformLogo(SearchUsing.slug, Slug, ImagePath);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<PlatformLogo> _GetPlatformLogo(SearchUsing searchUsing, object searchValue, string ImagePath)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("PlatformLogo", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("PlatformLogo", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("PlatformLogo", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
PlatformLogo returnValue = new PlatformLogo();
|
PlatformLogo returnValue = new PlatformLogo();
|
||||||
bool forceImageDownload = false;
|
bool forceImageDownload = false;
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
if (returnValue != null)
|
if (returnValue != null)
|
||||||
{
|
{
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
@@ -74,7 +46,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
|
|
||||||
// check if old value is different from the new value - only download if it's different
|
// check if old value is different from the new value - only download if it's different
|
||||||
@@ -86,7 +58,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<PlatformLogo>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<PlatformLogo>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -113,17 +85,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<PlatformLogo> GetObjectFromServer(long searchValue, string ImagePath)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<PlatformLogo> GetObjectFromServer(string WhereClause, string ImagePath)
|
|
||||||
{
|
{
|
||||||
// get Artwork metadata
|
// get Artwork metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<PlatformLogo>(IGDBClient.Endpoints.PlatformLogos, fieldList, WhereClause);
|
var results = await comms.APIComm<PlatformLogo>(Communications.MetadataEndpoint.PlatformLogo, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class PlatformVersions
|
public class PlatformVersions
|
||||||
{
|
{
|
||||||
const string fieldList = "fields checksum,companies,connectivity,cpu,graphics,main_manufacturer,media,memory,name,online,os,output,platform_logo,platform_version_release_dates,resolutions,slug,sound,storage,summary,url;";
|
public const string fieldList = "fields checksum,companies,connectivity,cpu,graphics,main_manufacturer,media,memory,name,online,os,output,platform_logo,platform_version_release_dates,resolutions,slug,sound,storage,summary,url;";
|
||||||
|
|
||||||
public PlatformVersions()
|
public PlatformVersions()
|
||||||
{
|
{
|
||||||
@@ -21,49 +21,21 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<PlatformVersion> RetVal = _GetPlatformVersion(SearchUsing.id, Id, ParentPlatform, GetImages);
|
Task<PlatformVersion> RetVal = _GetPlatformVersion((long)Id, ParentPlatform, GetImages);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlatformVersion GetPlatformVersion(string Slug, Platform ParentPlatform, bool GetImages = false)
|
private static async Task<PlatformVersion> _GetPlatformVersion(long searchValue, Platform ParentPlatform, bool GetImages)
|
||||||
{
|
|
||||||
Task<PlatformVersion> RetVal = _GetPlatformVersion(SearchUsing.slug, Slug, ParentPlatform, GetImages);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<PlatformVersion> _GetPlatformVersion(SearchUsing searchUsing, object searchValue, Platform ParentPlatform, bool GetImages)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("PlatformVersion", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("PlatformVersion", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("PlatformVersion", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
PlatformVersion returnValue = new PlatformVersion();
|
PlatformVersion returnValue = new PlatformVersion();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
if (returnValue != null)
|
if (returnValue != null)
|
||||||
{
|
{
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
@@ -73,13 +45,13 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
UpdateSubClasses(ParentPlatform, returnValue, GetImages);
|
UpdateSubClasses(ParentPlatform, returnValue, GetImages);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<PlatformVersion>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<PlatformVersion>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
@@ -108,17 +80,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<PlatformVersion?> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<PlatformVersion?> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get PlatformVersion metadata
|
// get PlatformVersion metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<PlatformVersion>(IGDBClient.Endpoints.PlatformVersions, fieldList, WhereClause);
|
var results = await comms.APIComm<PlatformVersion>(Communications.MetadataEndpoint.PlatformVersion, searchValue);
|
||||||
if (results.Length > 0)
|
if (results.Length > 0)
|
||||||
{
|
{
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
@@ -8,7 +8,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Platforms
|
public class Platforms
|
||||||
{
|
{
|
||||||
const string fieldList = "fields abbreviation,alternative_name,category,checksum,created_at,generation,name,platform_family,platform_logo,slug,summary,updated_at,url,versions,websites;";
|
public const string fieldList = "fields abbreviation,alternative_name,category,checksum,created_at,generation,name,platform_family,platform_logo,slug,summary,updated_at,url,versions,websites;";
|
||||||
|
|
||||||
public Platforms()
|
public Platforms()
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Task<Platform> RetVal = _GetPlatform(SearchUsing.id, Id, forceRefresh, GetImages);
|
Task<Platform> RetVal = _GetPlatform(SearchUsing.Id, Id, forceRefresh, GetImages);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -54,7 +54,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
|
|
||||||
public static Platform GetPlatform(string Slug, bool forceRefresh = false, bool GetImages = false)
|
public static Platform GetPlatform(string Slug, bool forceRefresh = false, bool GetImages = false)
|
||||||
{
|
{
|
||||||
Task<Platform> RetVal = _GetPlatform(SearchUsing.slug, Slug, forceRefresh, GetImages);
|
Task<Platform> RetVal = _GetPlatform(SearchUsing.Slug, Slug, forceRefresh, GetImages);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
||||||
if (searchUsing == SearchUsing.id)
|
if (searchUsing == SearchUsing.Id)
|
||||||
{
|
{
|
||||||
cacheStatus = Storage.GetCacheStatus("Platform", (long)searchValue);
|
cacheStatus = Storage.GetCacheStatus("Platform", (long)searchValue);
|
||||||
}
|
}
|
||||||
@@ -76,28 +76,18 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
if (cacheStatus == Storage.CacheStatus.Current) { cacheStatus = Storage.CacheStatus.Expired; }
|
if (cacheStatus == Storage.CacheStatus.Current) { cacheStatus = Storage.CacheStatus.Expired; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
string searchField = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
searchField = "id";
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = \"" + searchValue + "\"";
|
|
||||||
searchField = "slug";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform returnValue = new Platform();
|
Platform returnValue = new Platform();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
if (searchUsing == SearchUsing.Id)
|
||||||
|
{
|
||||||
|
returnValue = await GetObjectFromServer((long)searchValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = await GetObjectFromServer((string)searchValue);
|
||||||
|
}
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
UpdateSubClasses(returnValue, GetImages);
|
UpdateSubClasses(returnValue, GetImages);
|
||||||
AddPlatformMapping(returnValue);
|
AddPlatformMapping(returnValue);
|
||||||
@@ -105,7 +95,14 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
if (searchUsing == SearchUsing.Id)
|
||||||
|
{
|
||||||
|
returnValue = await GetObjectFromServer((long)searchValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnValue = await GetObjectFromServer((string)searchValue);
|
||||||
|
}
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
UpdateSubClasses(returnValue, GetImages);
|
UpdateSubClasses(returnValue, GetImages);
|
||||||
AddPlatformMapping(returnValue);
|
AddPlatformMapping(returnValue);
|
||||||
@@ -113,11 +110,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id/Slug: " + searchValue, ex);
|
||||||
return Storage.GetCacheValue<Platform>(returnValue, searchField, searchValue);
|
return Storage.GetCacheValue<Platform>(returnValue, searchUsing.ToString(), searchValue);
|
||||||
}
|
}
|
||||||
case Storage.CacheStatus.Current:
|
case Storage.CacheStatus.Current:
|
||||||
return Storage.GetCacheValue<Platform>(returnValue, searchField, searchValue);
|
return Storage.GetCacheValue<Platform>(returnValue, searchUsing.ToString(), searchValue);
|
||||||
default:
|
default:
|
||||||
throw new Exception("How did you get here?");
|
throw new Exception("How did you get here?");
|
||||||
}
|
}
|
||||||
@@ -177,15 +174,25 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
|
|
||||||
private enum SearchUsing
|
private enum SearchUsing
|
||||||
{
|
{
|
||||||
id,
|
Id,
|
||||||
slug
|
Slug
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<Platform> GetObjectFromServer(string WhereClause)
|
private static async Task<Platform> GetObjectFromServer(string Slug)
|
||||||
{
|
{
|
||||||
// get platform metadata
|
// get platform metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Platform>(IGDBClient.Endpoints.Platforms, fieldList, WhereClause);
|
var results = await comms.APIComm<Platform>(Communications.MetadataEndpoint.Platform, Slug);
|
||||||
|
var result = results.First();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task<Platform> GetObjectFromServer(long Id)
|
||||||
|
{
|
||||||
|
// get platform metadata
|
||||||
|
Communications comms = new Communications();
|
||||||
|
var results = await comms.APIComm<Platform>(Communications.MetadataEndpoint.Platform, Id);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class PlayerPerspectives
|
public class PlayerPerspectives
|
||||||
{
|
{
|
||||||
const string fieldList = "fields checksum,created_at,name,slug,updated_at,url;";
|
public const string fieldList = "fields checksum,created_at,name,slug,updated_at,url;";
|
||||||
|
|
||||||
public PlayerPerspectives()
|
public PlayerPerspectives()
|
||||||
{
|
{
|
||||||
@@ -21,62 +21,34 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<PlayerPerspective> RetVal = _GetGame_PlayerPerspectives(SearchUsing.id, Id);
|
Task<PlayerPerspective> RetVal = _GetGame_PlayerPerspectives((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerPerspective GetGame_PlayerPerspectives(string Slug)
|
private static async Task<PlayerPerspective> _GetGame_PlayerPerspectives(long searchValue)
|
||||||
{
|
|
||||||
Task<PlayerPerspective> RetVal = _GetGame_PlayerPerspectives(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<PlayerPerspective> _GetGame_PlayerPerspectives(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("PlayerPerspective", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("PlayerPerspective", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("PlayerPerspective", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerPerspective returnValue = new PlayerPerspective();
|
PlayerPerspective returnValue = new PlayerPerspective();
|
||||||
bool forceImageDownload = false;
|
bool forceImageDownload = false;
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
forceImageDownload = true;
|
forceImageDownload = true;
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<PlayerPerspective>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<PlayerPerspective>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -90,17 +62,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<PlayerPerspective> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<PlayerPerspective> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get Game_PlayerPerspectives metadata
|
// get Game_PlayerPerspectives metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<PlayerPerspective>(IGDBClient.Endpoints.PlayerPerspectives, fieldList, WhereClause);
|
var results = await comms.APIComm<PlayerPerspective>(Communications.MetadataEndpoint.PlayerPerspective, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class ReleaseDates
|
public class ReleaseDates
|
||||||
{
|
{
|
||||||
const string fieldList = "fields category,checksum,created_at,date,game,human,m,platform,region,status,updated_at,y;";
|
public const string fieldList = "fields category,checksum,created_at,date,game,human,m,platform,region,status,updated_at,y;";
|
||||||
|
|
||||||
public ReleaseDates()
|
public ReleaseDates()
|
||||||
{
|
{
|
||||||
@@ -21,60 +21,32 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<ReleaseDate> RetVal = _GetReleaseDates(SearchUsing.id, Id);
|
Task<ReleaseDate> RetVal = _GetReleaseDates((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ReleaseDate GetReleaseDates(string Slug)
|
private static async Task<ReleaseDate> _GetReleaseDates(long searchValue)
|
||||||
{
|
|
||||||
Task<ReleaseDate> RetVal = _GetReleaseDates(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<ReleaseDate> _GetReleaseDates(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("ReleaseDate", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("ReleaseDate", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("ReleaseDate", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
ReleaseDate returnValue = new ReleaseDate();
|
ReleaseDate returnValue = new ReleaseDate();
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<ReleaseDate>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<ReleaseDate>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -88,17 +60,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<ReleaseDate> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<ReleaseDate> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get ReleaseDates metadata
|
// get ReleaseDates metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<ReleaseDate>(IGDBClient.Endpoints.ReleaseDates, fieldList, WhereClause);
|
var results = await comms.APIComm<ReleaseDate>(Communications.MetadataEndpoint.ReleaseDate, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Screenshots
|
public class Screenshots
|
||||||
{
|
{
|
||||||
const string fieldList = "fields alpha_channel,animated,checksum,game,height,image_id,url,width;";
|
public const string fieldList = "fields alpha_channel,animated,checksum,game,height,image_id,url,width;";
|
||||||
|
|
||||||
public Screenshots()
|
public Screenshots()
|
||||||
{
|
{
|
||||||
@@ -21,43 +21,15 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Screenshot> RetVal = _GetScreenshot(SearchUsing.id, Id, ImagePath, GetImages);
|
Task<Screenshot> RetVal = _GetScreenshot((long)Id, ImagePath, GetImages);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Screenshot GetScreenshot(string Slug, string ImagePath, bool GetImages)
|
private static async Task<Screenshot> _GetScreenshot(long searchValue, string ImagePath, bool GetImages = true)
|
||||||
{
|
|
||||||
Task<Screenshot> RetVal = _GetScreenshot(SearchUsing.slug, Slug, ImagePath, GetImages);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Screenshot> _GetScreenshot(SearchUsing searchUsing, object searchValue, string ImagePath, bool GetImages = true)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("Screenshot", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Screenshot", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Screenshot", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Screenshot returnValue = new Screenshot();
|
Screenshot returnValue = new Screenshot();
|
||||||
bool forceImageDownload = false;
|
bool forceImageDownload = false;
|
||||||
@@ -65,14 +37,14 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
forceImageDownload = true;
|
forceImageDownload = true;
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause, ImagePath);
|
returnValue = await GetObjectFromServer(searchValue, ImagePath);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
|
|
||||||
// check if old value is different from the new value - only download if it's different
|
// check if old value is different from the new value - only download if it's different
|
||||||
@@ -84,7 +56,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
returnValue = Storage.GetCacheValue<Screenshot>(returnValue, "id", (long)searchValue);
|
returnValue = Storage.GetCacheValue<Screenshot>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -111,17 +83,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<Screenshot> GetObjectFromServer(long searchValue, string ImagePath)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Screenshot> GetObjectFromServer(string WhereClause, string ImagePath)
|
|
||||||
{
|
{
|
||||||
// get Screenshot metadata
|
// get Screenshot metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Screenshot>(IGDBClient.Endpoints.Screenshots, fieldList, WhereClause);
|
var results = await comms.APIComm<Screenshot>(Communications.MetadataEndpoint.Screenshot, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -7,7 +7,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
{
|
{
|
||||||
public class Themes
|
public class Themes
|
||||||
{
|
{
|
||||||
const string fieldList = "fields checksum,created_at,name,slug,updated_at,url;";
|
public const string fieldList = "fields checksum,created_at,name,slug,updated_at,url;";
|
||||||
|
|
||||||
public Themes()
|
public Themes()
|
||||||
{
|
{
|
||||||
@@ -21,63 +21,35 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Task<Theme> RetVal = _GetGame_Themes(SearchUsing.id, Id);
|
Task<Theme> RetVal = _GetGame_Themes((long)Id);
|
||||||
return RetVal.Result;
|
return RetVal.Result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Theme GetGame_Themes(string Slug)
|
private static async Task<Theme> _GetGame_Themes(long searchValue)
|
||||||
{
|
|
||||||
Task<Theme> RetVal = _GetGame_Themes(SearchUsing.slug, Slug);
|
|
||||||
return RetVal.Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Theme> _GetGame_Themes(SearchUsing searchUsing, object searchValue)
|
|
||||||
{
|
{
|
||||||
// check database first
|
// check database first
|
||||||
Storage.CacheStatus? cacheStatus = new Storage.CacheStatus();
|
Storage.CacheStatus? cacheStatus = Storage.GetCacheStatus("Theme", searchValue);
|
||||||
if (searchUsing == SearchUsing.id)
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Theme", (long)searchValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheStatus = Storage.GetCacheStatus("Theme", (string)searchValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up where clause
|
|
||||||
string WhereClause = "";
|
|
||||||
switch (searchUsing)
|
|
||||||
{
|
|
||||||
case SearchUsing.id:
|
|
||||||
WhereClause = "where id = " + searchValue;
|
|
||||||
break;
|
|
||||||
case SearchUsing.slug:
|
|
||||||
WhereClause = "where slug = " + searchValue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Invalid search type");
|
|
||||||
}
|
|
||||||
|
|
||||||
Theme returnValue = new Theme();
|
Theme returnValue = new Theme();
|
||||||
bool forceImageDownload = false;
|
bool forceImageDownload = false;
|
||||||
switch (cacheStatus)
|
switch (cacheStatus)
|
||||||
{
|
{
|
||||||
case Storage.CacheStatus.NotPresent:
|
case Storage.CacheStatus.NotPresent:
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue);
|
Storage.NewCacheValue(returnValue);
|
||||||
forceImageDownload = true;
|
forceImageDownload = true;
|
||||||
break;
|
break;
|
||||||
case Storage.CacheStatus.Expired:
|
case Storage.CacheStatus.Expired:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
returnValue = await GetObjectFromServer(WhereClause);
|
returnValue = await GetObjectFromServer(searchValue);
|
||||||
Storage.NewCacheValue(returnValue, true);
|
Storage.NewCacheValue(returnValue, true);
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. WhereClause: " + WhereClause, ex);
|
Logging.Log(Logging.LogType.Warning, "Metadata: " + returnValue.GetType().Name, "An error occurred while connecting to IGDB. Id: " + searchValue, ex);
|
||||||
return Storage.GetCacheValue<Theme>(returnValue, "id", (long)searchValue);
|
return Storage.GetCacheValue<Theme>(returnValue, "id", (long)searchValue);
|
||||||
}
|
}
|
||||||
case Storage.CacheStatus.Current:
|
case Storage.CacheStatus.Current:
|
||||||
@@ -90,17 +62,11 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SearchUsing
|
private static async Task<Theme> GetObjectFromServer(long searchValue)
|
||||||
{
|
|
||||||
id,
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<Theme> GetObjectFromServer(string WhereClause)
|
|
||||||
{
|
{
|
||||||
// get Game_Themes metadata
|
// get Game_Themes metadata
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
var results = await comms.APIComm<Theme>(IGDBClient.Endpoints.Themes, fieldList, WhereClause);
|
var results = await comms.APIComm<Theme>(Communications.MetadataEndpoint.Theme, searchValue);
|
||||||
var result = results.First();
|
var result = results.First();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -202,7 +202,8 @@ namespace gaseous_server.Classes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HasheousClient.WebApp.HttpHelper.AddHeader("X-API-Key", Config.MetadataConfiguration.HasheousAPIKey);
|
HasheousClient.WebApp.HttpHelper.APIKey = Config.MetadataConfiguration.HasheousAPIKey;
|
||||||
|
HasheousClient.WebApp.HttpHelper.ClientKey = Config.MetadataConfiguration.HasheousClientAPIKey;
|
||||||
HasheousClient.Hasheous hasheousClient = new HasheousClient.Hasheous();
|
HasheousClient.Hasheous hasheousClient = new HasheousClient.Hasheous();
|
||||||
List<MetadataMatch> metadataMatchList = new List<MetadataMatch>();
|
List<MetadataMatch> metadataMatchList = new List<MetadataMatch>();
|
||||||
metadataMatchList.Add(new MetadataMatch(HasheousClient.Models.MetadataSources.IGDB, platform.Slug, game.Slug));
|
metadataMatchList.Add(new MetadataMatch(HasheousClient.Models.MetadataSources.IGDB, platform.Slug, game.Slug));
|
||||||
|
@@ -73,6 +73,7 @@ namespace gaseous_server.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("Version")]
|
[Route("Version")]
|
||||||
[ProducesResponseType(typeof(Dictionary<string, object>), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(Dictionary<string, object>), StatusCodes.Status200OK)]
|
||||||
|
[AllowAnonymous]
|
||||||
public ActionResult GetSystemVersion()
|
public ActionResult GetSystemVersion()
|
||||||
{
|
{
|
||||||
Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
|
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
|
||||||
<PackageReference Include="gaseous-signature-parser" Version="2.2.1" />
|
<PackageReference Include="gaseous-signature-parser" Version="2.2.1" />
|
||||||
<PackageReference Include="gaseous.IGDB" Version="1.0.2" />
|
<PackageReference Include="gaseous.IGDB" Version="1.0.2" />
|
||||||
<PackageReference Include="hasheous-client" Version="1.0.4.4" />
|
<PackageReference Include="hasheous-client" Version="1.1.0" />
|
||||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.8.0" />
|
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.8.0" />
|
||||||
<PackageReference Include="sharpcompress" Version="0.37.2" />
|
<PackageReference Include="sharpcompress" Version="0.37.2" />
|
||||||
<PackageReference Include="Squid-Box.SevenZipSharp" Version="1.6.2.24" />
|
<PackageReference Include="Squid-Box.SevenZipSharp" Version="1.6.2.24" />
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<div id="gamepage">
|
<div id="gamepage">
|
||||||
<div style="padding-top: 20px;">
|
<div style="padding-top: 20px;">
|
||||||
<div id="gamehome" style="display: inline-block; max-width: 820px; margin-right: 20px; vertical-align: top;">
|
<div id="gamehome"
|
||||||
|
style="display: inline-block; max-width: 820px; margin-right: 20px; vertical-align: top; width: 100%;">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="gameprofile" style="display: inline-block; width: 250px;">
|
<div id="gameprofile" style="display: inline-block; width: 250px;">
|
||||||
|
Reference in New Issue
Block a user