Skip to content

Commit

Permalink
Merge pull request #29 from KrystianLesniak/develop
Browse files Browse the repository at this point in the history
Release: 1.4.4
  • Loading branch information
KrystianLesniak authored Oct 10, 2023
2 parents 8fde58b + ddb9c3f commit 36de16d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using Microsoft.Data.Sqlite;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Data;
using System.Text.Json;
using System.Text.Json.Nodes;
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;

namespace GamesLauncher.Platforms.SyncEngines.Amazon.Readers
{
Expand Down Expand Up @@ -38,13 +39,21 @@ FROM game_product_info
await using var reader = await command.ExecuteReaderAsync();
while (reader.Read())
{
await using var json = reader.GetStream(0);
var jsonNode = (await JsonSerializer.DeserializeAsync<JsonNode>(json))?["ProductIconUrl"];
var json = reader.GetString(0);

if (jsonNode == null)
var jsonProductIconValue = JsonConvert.DeserializeObject<JObject>(json, new JsonSerializerSettings
{
Error = delegate (object? sender, ErrorEventArgs args) // When malfunctioned JSON return null
{
args.ErrorContext.Handled = true;
}
})
?.Value<string?>("ProductIconUrl");

if (jsonProductIconValue == null)
continue;

return jsonNode.GetValue<string>();
return jsonProductIconValue;
}

return fallbackIcon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ private static async Task<IEnumerable<EpicGame>> GetEpicGamesFromMetadata()

var jObject = JsonConvert.DeserializeObject<JObject>(fileContent, new JsonSerializerSettings
{
Error = delegate (object? sender, ErrorEventArgs args)
Error = delegate (object? sender, ErrorEventArgs args) // When malfunctioned JSON return null
{
args.ErrorContext.Handled = true;
}
});


var game = EpicGame.CreateFromJObject(jObject);

if (game != null)
Expand Down
4 changes: 1 addition & 3 deletions src/GamesLauncher.Platforms/SyncEngines/XboxSyncEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ public async IAsyncEnumerable<Game> GetGames()

foreach (var game in games)
{
var gameTitle = game.DisplayName;

var shellGame = appsFolder.FirstOrDefault(x => x.ParsingName.StartsWith(game.Id.Value));

if (shellGame != null)
{
var cmd = $"shell:appsFolder\\{shellGame.ParsingName}";

yield return new Game(
Title: gameTitle,
Title: shellGame.Name,
Platform: PlatformName,
RunTask: GetGameRunTask(cmd),
IconPath: null,
Expand Down
2 changes: 1 addition & 1 deletion src/GamesLauncher/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Name": "GamesLauncher",
"Description": "Search and launch games from multiple platforms like Steam, Epic Games, Xbox etc.",
"Author": "KrystianLesniak",
"Version": "1.4.3",
"Version": "1.4.4",
"Language": "csharp",
"Website": "https://github.com/KrystianLesniak/Flow.Launcher.Plugin.GamesLauncher",
"IcoPath": "icon.png",
Expand Down

0 comments on commit 36de16d

Please sign in to comment.