diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..87c57ab Binary files /dev/null and b/.DS_Store differ diff --git a/gaseous-server/.DS_Store b/gaseous-server/.DS_Store new file mode 100644 index 0000000..f0d37de Binary files /dev/null and b/gaseous-server/.DS_Store differ diff --git a/gaseous-server/Classes/Metadata/Storage.cs b/gaseous-server/Classes/Metadata/Storage.cs index bb26ccd..8d543cc 100644 --- a/gaseous-server/Classes/Metadata/Storage.cs +++ b/gaseous-server/Classes/Metadata/Storage.cs @@ -39,7 +39,7 @@ namespace gaseous_server.Classes.Metadata DataTable dt = db.ExecuteCMD(sql, dbDict); if (dt.Rows.Count == 0) { - // no data stored for this item, or lastUpdated + // no data stored for this item, or lastUpdated return CacheStatus.NotPresent; } else @@ -77,13 +77,16 @@ namespace gaseous_server.Classes.Metadata { fieldList = fieldList + ", "; valueList = valueList + ", "; - updateFieldValueList = updateFieldValueList + ", "; } fieldList = fieldList + key.Key; valueList = valueList + "@" + key.Key; if ((key.Key != "id") && (key.Key != "dateAdded")) - { - updateFieldValueList = key.Key + " = @" + key.Key; + { + if (updateFieldValueList.Length > 0) + { + updateFieldValueList = updateFieldValueList + ", "; + } + updateFieldValueList += key.Key + " = @" + key.Key; } // check property type diff --git a/gaseous-server/Classes/MetadataManagement.cs b/gaseous-server/Classes/MetadataManagement.cs index 4c51df2..8190f53 100644 --- a/gaseous-server/Classes/MetadataManagement.cs +++ b/gaseous-server/Classes/MetadataManagement.cs @@ -14,8 +14,15 @@ namespace gaseous_server.Classes foreach (DataRow dr in dt.Rows) { - Logging.Log(Logging.LogType.Information, "Metadata Refresh", "Refreshing metadata for game " + dr["name"] + " (" + dr["id"] + ")"); - Metadata.Games.GetGame((long)dr["id"], true, forceRefresh); + try + { + Logging.Log(Logging.LogType.Information, "Metadata Refresh", "Refreshing metadata for game " + dr["name"] + " (" + dr["id"] + ")"); + Metadata.Games.GetGame((long)dr["id"], true, forceRefresh); + } + catch (Exception ex) + { + Logging.Log(Logging.LogType.Critical, "Metadata Refresh", "An error occurred while refreshing metadata for " + dr["name"], ex); + } } } } diff --git a/gaseous-server/Classes/Roms.cs b/gaseous-server/Classes/Roms.cs index f85fe68..4195489 100644 --- a/gaseous-server/Classes/Roms.cs +++ b/gaseous-server/Classes/Roms.cs @@ -81,7 +81,9 @@ namespace gaseous_server.Classes Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); string sql = "DELETE FROM games_roms WHERE id = @id"; - db.ExecuteCMD(sql); + Dictionary dbDict = new Dictionary(); + dbDict.Add("id", RomId); + db.ExecuteCMD(sql, dbDict); } private static GameRomItem BuildRom(DataRow romDR) diff --git a/gaseous-server/Controllers/GamesController.cs b/gaseous-server/Controllers/GamesController.cs index ed99732..fa5a609 100644 --- a/gaseous-server/Controllers/GamesController.cs +++ b/gaseous-server/Controllers/GamesController.cs @@ -136,11 +136,11 @@ namespace gaseous_server.Controllers [Route("{GameId}")] [ProducesResponseType(typeof(Game), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public ActionResult Game(long GameId) + public ActionResult Game(long GameId, bool forceRefresh = false) { try { - IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false); + IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, forceRefresh); if (gameObject != null) { diff --git a/gaseous-server/gaseous-server.csproj b/gaseous-server/gaseous-server.csproj index 74fb485..9614837 100644 --- a/gaseous-server/gaseous-server.csproj +++ b/gaseous-server/gaseous-server.csproj @@ -9,6 +9,10 @@ + + 4 + bin\Debug\net7.0\gaseous-server.xml + @@ -62,6 +66,9 @@ + + + @@ -78,6 +85,9 @@ + + + diff --git a/gaseous-server/wwwroot/.DS_Store b/gaseous-server/wwwroot/.DS_Store new file mode 100644 index 0000000..cd3a2cf Binary files /dev/null and b/gaseous-server/wwwroot/.DS_Store differ diff --git a/gaseous-server/wwwroot/images/logo.png b/gaseous-server/wwwroot/images/logo.png new file mode 100644 index 0000000..302efbb Binary files /dev/null and b/gaseous-server/wwwroot/images/logo.png differ diff --git a/gaseous-server/wwwroot/images/unknowngame.png b/gaseous-server/wwwroot/images/unknowngame.png new file mode 100644 index 0000000..073f4a8 Binary files /dev/null and b/gaseous-server/wwwroot/images/unknowngame.png differ diff --git a/gaseous-server/wwwroot/index.html b/gaseous-server/wwwroot/index.html index e1e96d8..ccca86d 100644 --- a/gaseous-server/wwwroot/index.html +++ b/gaseous-server/wwwroot/index.html @@ -2,9 +2,35 @@ - + + + + + + Gaseous - Hello World! + + + +
+
+
+
+ diff --git a/gaseous-server/wwwroot/scripts/filterformating.js b/gaseous-server/wwwroot/scripts/filterformating.js new file mode 100644 index 0000000..85dd088 --- /dev/null +++ b/gaseous-server/wwwroot/scripts/filterformating.js @@ -0,0 +1,76 @@ +function formatFilterPanel(targetElement, result) { + var panel = document.createElement('div'); + panel.id = 'filter_panel_box'; + + panel.appendChild(buildFilterPanelHeader('filter', 'Filter')); + + var containerPanelSearch = document.createElement('div'); + containerPanelSearch.className = 'filter_panel_box'; + var containerPanelSearchField = document.createElement('input'); + containerPanelSearchField.type = 'text'; + containerPanelSearch.appendChild(containerPanelSearchField); + + panel.appendChild(containerPanelSearch); + + if (result.platforms) { + panel.appendChild(buildFilterPanelHeader('platforms', 'Platforms')); + + var containerPanelPlatform = document.createElement('div'); + containerPanelPlatform.className = 'filter_panel_box'; + for (var i = 0; i < result.platforms.length; i++) { + containerPanelPlatform.appendChild(buildFilterPanelItem(result.platforms[i].id, result.platforms[i].name)); + } + panel.appendChild(containerPanelPlatform); + + targetElement.appendChild(panel); + } + + if (result.genres) { + panel.appendChild(buildFilterPanelHeader('genres', 'Genres')); + + var containerPanelGenres = document.createElement('div'); + containerPanelGenres.className = 'filter_panel_box'; + for (var i = 0; i < result.genres.length; i++) { + containerPanelGenres.appendChild(buildFilterPanelItem(result.genres[i].id, result.genres[i].name)); + } + panel.appendChild(containerPanelGenres); + + targetElement.appendChild(panel); + } + + +} + +function buildFilterPanelHeader(headerString, friendlyHeaderString) { + var header = document.createElement('div'); + header.id = 'filter_panel_header_' + headerString; + header.className = 'filter_header'; + header.innerHTML = friendlyHeaderString; + + return header; +} + +function buildFilterPanelItem(itemString, friendlyItemString) { + var filterPanelItem = document.createElement('div'); + filterPanelItem.id = 'filter_panel_item_' + itemString; + filterPanelItem.className = 'filter_panel_item'; + + var filterPanelItemCheckBox = document.createElement('div'); + + var filterPanelItemCheckBoxItem = document.createElement('input'); + filterPanelItemCheckBoxItem.id = 'filter_panel_item_checkbox_' + itemString; + filterPanelItemCheckBoxItem.type = 'checkbox'; + filterPanelItemCheckBoxItem.className = 'filter_panel_item_checkbox'; + filterPanelItemCheckBox.appendChild(filterPanelItemCheckBoxItem); + + var filterPanelItemLabel = document.createElement('label'); + filterPanelItemLabel.id = 'filter_panel_item_label_' + itemString; + filterPanelItemLabel.className = 'filter_panel_item_label'; + filterPanelItemLabel.setAttribute('for', filterPanelItemCheckBoxItem.id); + filterPanelItemLabel.innerHTML = friendlyItemString; + + filterPanelItem.appendChild(filterPanelItemCheckBox); + filterPanelItem.appendChild(filterPanelItemLabel); + + return filterPanelItem; +} \ No newline at end of file diff --git a/gaseous-server/wwwroot/scripts/gamesformating.js b/gaseous-server/wwwroot/scripts/gamesformating.js new file mode 100644 index 0000000..0728726 --- /dev/null +++ b/gaseous-server/wwwroot/scripts/gamesformating.js @@ -0,0 +1,41 @@ +function formatGamesPanel(targetElement, result) { + for (var i = 0; i < result.length; i++) { + var game = renderGameIcon(result[i], true, false); + targetElement.appendChild(game); + } +} + +function renderGameIcon(gameObject, showTitle, showRatings) { + var gameBox = document.createElement('div'); + gameBox.className = 'game_tile'; + + var gameImage = document.createElement('img'); + gameImage.className = 'game_tile_image'; + if (gameObject.cover) { + gameImage.src = '/api/v1/Games/' + gameObject.id + '/cover/image'; + } else { + gameImage.src = '/images/unknowngame.png'; + gameImage.className = 'game_tile_image unknown'; + } + gameBox.appendChild(gameImage); + + if (showTitle == true) { + var gameBoxTitle = document.createElement('div'); + gameBoxTitle.class = 'game_tile_label'; + gameBoxTitle.innerHTML = gameObject.name; + gameBox.appendChild(gameBoxTitle); + } + + if (showRatings == true) { + if (gameObject.ageRatings) { + for (var i = 0; i < gameObject.ageRatings.ids.length; i++) { + var ratingImage = document.createElement('img'); + ratingImage.src = '/api/v1/Games/' + gameObject.id + '/agerating/' + gameObject.ageRatings.ids[i] + '/image'; + ratingImage.className = 'rating_image_mini'; + gameBox.appendChild(ratingImage); + } + } + } + + return gameBox; +} \ No newline at end of file diff --git a/gaseous-server/wwwroot/scripts/main.js b/gaseous-server/wwwroot/scripts/main.js new file mode 100644 index 0000000..9fc64e2 --- /dev/null +++ b/gaseous-server/wwwroot/scripts/main.js @@ -0,0 +1,24 @@ +function ajaxCall(endpoint, method, successFunction) { + $.ajax({ + + // Our sample url to make request + url: + endpoint, + + // Type of Request + type: method, + + // Function to call when to + // request is ok + success: function (data) { + var x = JSON.stringify(data); + console.log(x); + successFunction(data); + }, + + // Error handling + error: function (error) { + console.log(`Error ${error}`); + } + }); +} diff --git a/gaseous-server/wwwroot/styles/style.css b/gaseous-server/wwwroot/styles/style.css new file mode 100644 index 0000000..0c5fb57 --- /dev/null +++ b/gaseous-server/wwwroot/styles/style.css @@ -0,0 +1,121 @@ +body { + background-color: #383838; + color: white; + font-family: "PT Sans", Arial, Helvetica, sans-serif; + font-kerning: normal; + font-style: normal; + font-weight: 100; + font-size: 13px; +} + +#banner_icon { + background-color: white; + position: fixed; + top: 0px; + left: 0px; + width: 40px; + height: 40px; + align-items: center; + justify-content: center; + padding: 0px; + margin: 0px; + display: flex; +} + +#banner_icon_image { + width: 30px; + height: 30px; +} + +#banner_header { + background-color: #001638; + position: fixed; + top: 0px; + left: 40px; + height: 40px; + right: 0px; + align-items: center; + display: flex; +} + +#banner_header_label { + display: inline; + padding: 10px; + font-size: 18pt; + font-weight: 700; + color: #edeffa; +} + +#content { + display: flex; + padding-top: 45px; + padding-left: 5px; + padding-right: 5px; +} + +#games_filter { + width: 200px; + border-style: solid; + border-width: 1px; + border-color: #2b2b2b; + margin-right: 10px; +} + +.filter_header { + padding: 10px; + background-color: #2b2b2b; +} + +.filter_panel_box { + padding: 10px; +} + +.filter_panel_item { + display: flex; + padding: 3px; +} + +.filter_panel_item_checkbox { + margin-right: 10px; +} + +#games_library { + width: 90%; + border-style: solid; + border-width: 1px; + border-color: #2b2b2b; + padding: 10px; +} + +.game_tile { + padding: 5px; + display: inline-block; + width: 220px; + align-items: center; + justify-content: center; + text-align: center; + vertical-align: top; + margin-bottom: 10px; +} + +.game_tile:hover { + cursor: pointer; + text-decoration: underline; + background-color: #2b2b2b; +} + +.game_tile_image { + max-width: 200px; + max-height: 200px; +} + +.game_tile_image, .unknown { + background-color: white; +} + +.rating_image_mini { + display: inline-block; + max-width: 32px; + max-height: 32px; + margin-right: 2px; +} \ No newline at end of file diff --git a/gaseous-signature-ingestor/gaseous-signature-ingestor.csproj.user b/gaseous-signature-ingestor/gaseous-signature-ingestor.csproj.user new file mode 100644 index 0000000..46978fa --- /dev/null +++ b/gaseous-signature-ingestor/gaseous-signature-ingestor.csproj.user @@ -0,0 +1,8 @@ + + + + Project + -tosecpath ~/Downloads/TOSEC\ -\ DAT\ Pack\ -\ Complete\ \(3764\)\ \(TOSEC-v2023-01-23\)/TOSEC/ + true + + \ No newline at end of file diff --git a/gaseous-tools/Database/MySQL/gaseous-1000.sql b/gaseous-tools/Database/MySQL/gaseous-1000.sql index 75a7db3..3e0143a 100644 --- a/gaseous-tools/Database/MySQL/gaseous-1000.sql +++ b/gaseous-tools/Database/MySQL/gaseous-1000.sql @@ -65,7 +65,7 @@ CREATE TABLE `alternativename` ( `id` bigint NOT NULL, `checksum` varchar(45) DEFAULT NULL, `comment` longtext, - `game` int DEFAULT NULL, + `game` bigint DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL,