From 1727a62150258e699ba73738bf46abdd9cb6d247 Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Sat, 28 Dec 2024 16:19:05 +1100 Subject: [PATCH] WIP --- gaseous-server/Classes/Filters.cs | 1 + gaseous-server/Classes/Metadata/Games.cs | 23 +-- gaseous-server/Classes/Metadata/Storage.cs | 2 +- gaseous-server/Classes/MetadataManagement.cs | 141 ++++++++++--------- gaseous-server/wwwroot/styles/style.css | 10 +- gaseous-server/wwwroot/styles/stylevars.css | 15 +- 6 files changed, 109 insertions(+), 83 deletions(-) diff --git a/gaseous-server/Classes/Filters.cs b/gaseous-server/Classes/Filters.cs index 570a69b..69697b5 100644 --- a/gaseous-server/Classes/Filters.cs +++ b/gaseous-server/Classes/Filters.cs @@ -25,6 +25,7 @@ namespace gaseous_server.Classes } string sql = "SELECT Platform.Id, Platform.`Name`, COUNT(Game.Id) AS GameCount FROM (SELECT DISTINCT Game.Id, view_Games_Roms.PlatformId, COUNT(view_Games_Roms.Id) AS RomCount FROM Game LEFT JOIN AgeGroup ON Game.Id = AgeGroup.GameId LEFT JOIN view_Games_Roms ON Game.Id = view_Games_Roms.GameId WHERE (" + ageRestriction_Platform + ") GROUP BY Game.Id , view_Games_Roms.PlatformId HAVING RomCount > 0) Game JOIN Platform ON Game.PlatformId = Platform.Id GROUP BY Platform.`Name`;"; + Console.WriteLine(sql); DataTable dbResponse = db.ExecuteCMD(sql, new Database.DatabaseMemoryCacheOptions(CacheEnabled: true, ExpirationSeconds: 300)); diff --git a/gaseous-server/Classes/Metadata/Games.cs b/gaseous-server/Classes/Metadata/Games.cs index 8ba7eaf..4f5c83f 100644 --- a/gaseous-server/Classes/Metadata/Games.cs +++ b/gaseous-server/Classes/Metadata/Games.cs @@ -287,8 +287,11 @@ ORDER BY Platform.`Name`;"; foreach (DataRow row in data.Rows) { HasheousClient.Models.Metadata.IGDB.Platform platform = Platforms.GetPlatform((long)row["PlatformId"]); + + // get the user emulator configuration PlatformMapping.UserEmulatorConfiguration? emulatorConfiguration = platformMapping.GetUserEmulator(UserId, GameId, (long)platform.Id); + // if no user configuration, get the platform emulator configuration if (emulatorConfiguration == null) { if (platform.Id != 0) @@ -303,18 +306,20 @@ ORDER BY Platform.`Name`;"; EnableBIOSFiles = platformMap.EnabledBIOSHashes }; } - else - { - emulatorConfiguration = new PlatformMapping.UserEmulatorConfiguration - { - EmulatorType = "", - Core = "", - EnableBIOSFiles = new List() - }; - } } } + // if still no configuration, create a blank one + if (emulatorConfiguration == null) + { + emulatorConfiguration = new PlatformMapping.UserEmulatorConfiguration + { + EmulatorType = "", + Core = "", + EnableBIOSFiles = new List() + }; + } + long? LastPlayedRomId = null; bool? LastPlayedIsMediagroup = false; string? LastPlayedRomName = null; diff --git a/gaseous-server/Classes/Metadata/Storage.cs b/gaseous-server/Classes/Metadata/Storage.cs index 16647ef..c313a52 100644 --- a/gaseous-server/Classes/Metadata/Storage.cs +++ b/gaseous-server/Classes/Metadata/Storage.cs @@ -334,7 +334,7 @@ namespace gaseous_server.Classes.Metadata switch (propertyTypeName.ToLower()) { case "system.collections.generic.list": - var listArray = Newtonsoft.Json.JsonConvert.DeserializeObject>(value.ToString()); + var listArray = Newtonsoft.Json.JsonConvert.DeserializeObject>(value.ToString()); property.SetValue(EndpointType, listArray); break; diff --git a/gaseous-server/Classes/MetadataManagement.cs b/gaseous-server/Classes/MetadataManagement.cs index 45e125a..0a7198d 100644 --- a/gaseous-server/Classes/MetadataManagement.cs +++ b/gaseous-server/Classes/MetadataManagement.cs @@ -345,99 +345,108 @@ namespace gaseous_server.Classes try { - MetadataSources metadataSource = (MetadataSources)Enum.Parse(typeof(MetadataSources), dr["GameIdType"].ToString()); - Logging.Log(Logging.LogType.Information, "Metadata Refresh", "(" + StatusCounter + "/" + dt.Rows.Count + "): Refreshing metadata for game " + dr["name"] + " (" + dr["id"] + ") using source " + metadataSource.ToString()); - HasheousClient.Models.Metadata.IGDB.Game game = Metadata.Games.GetGame(metadataSource, (long)dr["id"]); - - // get supporting metadata - if (game != null) + MetadataSources metadataSource; + if (dr["GameIdType"] == DBNull.Value) { - if (game.AgeRatings != null) + Logging.Log(Logging.LogType.Information, "Metadata Refresh", "(" + StatusCounter + "/" + dt.Rows.Count + "): Unable to refresh metadata for game " + dr["name"] + " (" + dr["id"] + ") - no source type specified"); + } + else + { + metadataSource = (MetadataSources)Enum.Parse(typeof(MetadataSources), dr["GameIdType"].ToString()); + + Logging.Log(Logging.LogType.Information, "Metadata Refresh", "(" + StatusCounter + "/" + dt.Rows.Count + "): Refreshing metadata for game " + dr["name"] + " (" + dr["id"] + ") using source " + metadataSource.ToString()); + HasheousClient.Models.Metadata.IGDB.Game game = Metadata.Games.GetGame(metadataSource, (long)dr["id"]); + + // get supporting metadata + if (game != null) { - foreach (long ageRatingId in game.AgeRatings) + if (game.AgeRatings != null) { - AgeRating ageRating = Metadata.AgeRatings.GetAgeRating(metadataSource, ageRatingId); - if (ageRating.ContentDescriptions != null) + foreach (long ageRatingId in game.AgeRatings) { - foreach (long ageRatingContentDescriptionId in ageRating.ContentDescriptions) + AgeRating ageRating = Metadata.AgeRatings.GetAgeRating(metadataSource, ageRatingId); + if (ageRating.ContentDescriptions != null) { - Metadata.AgeRatingContentDescriptions.GetAgeRatingContentDescriptions(metadataSource, ageRatingContentDescriptionId); + foreach (long ageRatingContentDescriptionId in ageRating.ContentDescriptions) + { + Metadata.AgeRatingContentDescriptions.GetAgeRatingContentDescriptions(metadataSource, ageRatingContentDescriptionId); + } } } } - } - if (game.AlternativeNames != null) - { - foreach (long alternateNameId in game.AlternativeNames) + if (game.AlternativeNames != null) { - Metadata.AlternativeNames.GetAlternativeNames(metadataSource, alternateNameId); + foreach (long alternateNameId in game.AlternativeNames) + { + Metadata.AlternativeNames.GetAlternativeNames(metadataSource, alternateNameId); + } } - } - if (game.Artworks != null) - { - foreach (long artworkId in game.Artworks) + if (game.Artworks != null) { - Metadata.Artworks.GetArtwork(metadataSource, artworkId); + foreach (long artworkId in game.Artworks) + { + Metadata.Artworks.GetArtwork(metadataSource, artworkId); + } } - } - if (game.Cover != null) - { - Metadata.Covers.GetCover(metadataSource, (long?)game.Cover); - } - if (game.GameModes != null) - { - foreach (long gameModeId in game.GameModes) + if (game.Cover != null) { - Metadata.GameModes.GetGame_Modes(metadataSource, gameModeId); + Metadata.Covers.GetCover(metadataSource, (long?)game.Cover); } - } - if (game.Genres != null) - { - foreach (long genreId in game.Genres) + if (game.GameModes != null) { - Metadata.Genres.GetGenres(metadataSource, genreId); + foreach (long gameModeId in game.GameModes) + { + Metadata.GameModes.GetGame_Modes(metadataSource, gameModeId); + } } - } - if (game.Videos != null) - { - foreach (long gameVideoId in game.Videos) + if (game.Genres != null) { - Metadata.GamesVideos.GetGame_Videos(metadataSource, gameVideoId); + foreach (long genreId in game.Genres) + { + Metadata.Genres.GetGenres(metadataSource, genreId); + } } - } - if (game.MultiplayerModes != null) - { - foreach (long multiplayerModeId in game.MultiplayerModes) + if (game.Videos != null) { - Metadata.MultiplayerModes.GetGame_MultiplayerModes(metadataSource, multiplayerModeId); + foreach (long gameVideoId in game.Videos) + { + Metadata.GamesVideos.GetGame_Videos(metadataSource, gameVideoId); + } } - } - if (game.PlayerPerspectives != null) - { - foreach (long playerPerspectiveId in game.PlayerPerspectives) + if (game.MultiplayerModes != null) { - Metadata.PlayerPerspectives.GetGame_PlayerPerspectives(metadataSource, playerPerspectiveId); + foreach (long multiplayerModeId in game.MultiplayerModes) + { + Metadata.MultiplayerModes.GetGame_MultiplayerModes(metadataSource, multiplayerModeId); + } } - } - if (game.ReleaseDates != null) - { - foreach (long releaseDateId in game.ReleaseDates) + if (game.PlayerPerspectives != null) { - Metadata.ReleaseDates.GetReleaseDates(metadataSource, releaseDateId); + foreach (long playerPerspectiveId in game.PlayerPerspectives) + { + Metadata.PlayerPerspectives.GetGame_PlayerPerspectives(metadataSource, playerPerspectiveId); + } } - } - if (game.Screenshots != null) - { - foreach (long screenshotId in game.Screenshots) + if (game.ReleaseDates != null) { - Metadata.Screenshots.GetScreenshot(metadataSource, screenshotId); + foreach (long releaseDateId in game.ReleaseDates) + { + Metadata.ReleaseDates.GetReleaseDates(metadataSource, releaseDateId); + } } - } - if (game.Themes != null) - { - foreach (long themeId in game.Themes) + if (game.Screenshots != null) { - Metadata.Themes.GetGame_Themes(metadataSource, themeId); + foreach (long screenshotId in game.Screenshots) + { + Metadata.Screenshots.GetScreenshot(metadataSource, screenshotId); + } + } + if (game.Themes != null) + { + foreach (long themeId in game.Themes) + { + Metadata.Themes.GetGame_Themes(metadataSource, themeId); + } } } } diff --git a/gaseous-server/wwwroot/styles/style.css b/gaseous-server/wwwroot/styles/style.css index c997e2e..abc18ab 100644 --- a/gaseous-server/wwwroot/styles/style.css +++ b/gaseous-server/wwwroot/styles/style.css @@ -1901,8 +1901,9 @@ div[name="properties_profile_toc_item"]:hover { button:not(.select2-selection__choice__remove):not(.select2-selection__clear):not(.ejs_menu_button):not(.bigbutton) { background-color: var(--button-background); + background: var(--button-background-gradient); color: var(--button-font-colour); - border-width: 1px; + border-width: 0px; border-color: var(--button-border); border-style: solid; border-radius: var(--standard-radius); @@ -1918,6 +1919,7 @@ button:not(.select2-selection__choice__remove):not(.select2-selection__clear):no button:not(.select2-selection__choice__remove):not(.select2-selection__clear):not(.ejs_menu_button):hover { background-color: var(--button-background-hover); + background: var(--button-background-hover); border-color: var(--button-border-hover); color: var(--button-font-colour-hover); cursor: pointer; @@ -1947,36 +1949,42 @@ button:not(.select2-selection__choice__remove):not(.select2-selection__clear):no .redbutton { background-color: var(--button-red-background) !important; + background: var(--button-red-background-gradient) !important; border-color: var(--button-red-border) !important; color: var(--button-red-font-colour) !important; } .redbutton:hover { background-color: var(--button-red-background-hover) !important; + background: var(--button-red-background-hover) !important; border-color: var(--button-red-border-hover) !important; color: var(--button-red-font-colour-hover) !important; } .redbutton:disabled { background-color: var(--button-red-background-disabled) !important; + background: var(--button-red-background-disabled) !important; border-color: var(--button-red-border-disabled) !important; color: var(--button-red-font-colour-disabled) !important; } .bluebutton { background-color: var(--button-blue-background) !important; + background: var(--button-blue-background-gradient) !important; border-color: var(--button-blue-border) !important; color: var(--button-blue-font-colour) !important; } .bluebutton:hover { background-color: var(--button-blue-background-hover) !important; + background: var(--button-blue-background-hover) !important; border-color: var(--button-blue-border-hover) !important; color: var(--button-blue-font-colour-hover) !important; } .bluebutton:disabled { background-color: var(--button-blue-background-disabled) !important; + background: var(--button-blue-background-disabled) !important; border-color: var(--button-blue-border-disabled) !important; color: var(--button-blue-font-colour-disabled) !important; } diff --git a/gaseous-server/wwwroot/styles/stylevars.css b/gaseous-server/wwwroot/styles/stylevars.css index 1c7e3c7..d03da71 100644 --- a/gaseous-server/wwwroot/styles/stylevars.css +++ b/gaseous-server/wwwroot/styles/stylevars.css @@ -42,7 +42,8 @@ --input-font-colour: var(--page-font-colour); /* button */ - --button-background: rgb(85, 85, 85); + --button-background: rgb(110, 109, 109); + --button-background-gradient: linear-gradient(140deg, rgba(110, 109, 109, 1) 0%, rgba(85, 85, 85, 1) 100%); --button-background-hover: rgb(136, 136, 136); --button-background-disabled: var(--button-background-hover); --button-border: rgb(85, 85, 85); @@ -51,19 +52,21 @@ --button-font-colour: rgb(255, 255, 255); --button-font-colour-hover: var(--button-font-colour); --button-font-colour-disabled: var(--button-border-hover); - --button-red-background: darkred; - --button-red-background-hover: red; + --button-red-background: rgb(139, 0, 0); + --button-red-background-gradient: linear-gradient(140deg, rgba(255, 0, 0, 1) 0%, rgba(139, 0, 0, 1) 100%); + --button-red-background-hover: rgb(255, 0, 0); --button-red-background-disabled: rgb(85, 85, 85); - --button-red-border: darkred; - --button-red-border-hover: red; + --button-red-border: rgb(139, 0, 0); + --button-red-border-hover: rgb(255, 0, 0); --button-red-border-disabled: rgb(85, 85, 85); --button-red-font-colour: rgb(255, 255, 255); --button-red-font-colour-hover: var(--button-red-font-colour); --button-red-font-colour-disabled: var(--button-red-font-colour); --button-blue-background: rgb(0, 0, 170); + --button-blue-background-gradient: linear-gradient(140deg, rgba(0, 0, 255, 1) 0%, rgba(0, 0, 150, 1) 100%); --button-blue-background-hover: rgb(0, 0, 255); --button-blue-background-disabled: rgb(85, 85, 85); - --button-blue-border: rgb(0, 0, 170); + --button-blue-border: rgb(0, 0, 255); --button-blue-border-hover: rgb(0, 0, 255); --button-blue-border-disabled: rgb(85, 85, 85); --button-blue-font-colour: rgb(255, 255, 255);