
* Resolved missing table errors. * These were due to some dynamically created tables being queried before they were created. * These tables are now created at start up. * Resolved many "INSERT" errors that were polluting the logs: * These were due to a race condition where sometimes the database would return the data as not being in the database causing Gaseous to try to insert it - even though the data was already there.
56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
using System.Reflection;
|
|
using gaseous_server.Classes;
|
|
using gaseous_server.Classes.Metadata;
|
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
|
|
|
namespace gaseous_server.Models
|
|
{
|
|
public class GaseousGame : IGDB.Models.Game
|
|
{
|
|
public GaseousGame()
|
|
{
|
|
|
|
}
|
|
|
|
public GaseousGame(IGDB.Models.Game game)
|
|
{
|
|
var targetType = this.GetType();
|
|
var sourceType = game.GetType();
|
|
foreach (var prop in targetType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty))
|
|
{
|
|
// check whether source object has the the property
|
|
var sp = sourceType.GetProperty(prop.Name);
|
|
if (sp != null)
|
|
{
|
|
// if yes, copy the value to the matching property
|
|
var value = sp.GetValue(game, null);
|
|
prop.SetValue(this, value, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool HasSavedGame { get; set; } = false;
|
|
|
|
public IGDB.Models.Cover? CoverItem
|
|
{
|
|
get
|
|
{
|
|
if (this.Cover != null)
|
|
{
|
|
if (this.Cover.Id != null)
|
|
{
|
|
// IGDB.Models.Cover cover = Covers.GetCover(Cover.Id, Config.LibraryConfiguration.LibraryMetadataDirectory_Game(this), false);
|
|
IGDB.Models.Cover cover = new IGDB.Models.Cover()
|
|
{
|
|
Id = this.Cover.Id
|
|
};
|
|
|
|
return cover;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
} |