Skip to content

Commit

Permalink
Merge pull request #32 from KrystianLesniak/develop
Browse files Browse the repository at this point in the history
Release: 1.4.5
  • Loading branch information
KrystianLesniak committed Oct 16, 2023
2 parents 36de16d + be8752c commit d6dadb5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/GamesLauncher.Common/Settings/LastPlayedGames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public int GetResultScoreByOrder(string internalGameId)
{
var index = OrderedGames.LastIndexOf(internalGameId);

return (++index) * 100;
return (++index) * 1000;
}

}
Expand Down
5 changes: 4 additions & 1 deletion src/GamesLauncher.Platforms/GamesLauncher.Platforms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PackageReference Include="GameFinder.StoreHandlers.Steam" Version="4.0.0" />
<PackageReference Include="GameFinder.StoreHandlers.Xbox" Version="4.0.0" />
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.11" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.12" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand All @@ -34,6 +34,9 @@
<None Update="Icons\steam.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Icons\xbox.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Binary file added src/GamesLauncher.Platforms/Icons/xbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 21 additions & 6 deletions src/GamesLauncher.Platforms/SyncEngines/XboxSyncEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using GameFinder.StoreHandlers.Xbox;
using Microsoft.WindowsAPICodePack.Shell;
using NexusMods.Paths;
using static Flow.Launcher.Plugin.Result;

namespace GamesLauncher.Platforms.SyncEngines
{
Expand Down Expand Up @@ -37,23 +38,22 @@ public async IAsyncEnumerable<Game> GetGames()
{
var cmd = $"shell:appsFolder\\{shellGame.ParsingName}";

var iconDelegate = GetIconDelegate(shellGame);

yield return new Game(
Title: shellGame.Name,
Platform: PlatformName,
RunTask: GetGameRunTask(cmd),
IconPath: null,
IconDelegate: delegate ()
{
return shellGame.Thumbnail.LargeBitmapSource;
}
IconPath: iconDelegate is null ? Path.Combine("Icons", "xbox.png") : null,
IconDelegate: iconDelegate
);
}
}

await Task.CompletedTask;
}

public Func<ActionContext, ValueTask<bool>> GetGameRunTask(string cmd)
private Func<ActionContext, ValueTask<bool>> GetGameRunTask(string cmd)
{
return (context) =>
{
Expand All @@ -62,5 +62,20 @@ public Func<ActionContext, ValueTask<bool>> GetGameRunTask(string cmd)
return ValueTask.FromResult(true);
};
}

private static IconDelegate? GetIconDelegate(ShellObject shellGame)
{
var bitmapSource = shellGame.Thumbnail.LargeBitmapSource;

if (bitmapSource == null || bitmapSource.CanFreeze == false)
return null;

bitmapSource.Freeze();

return delegate ()
{
return bitmapSource;
};
}
}
}
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.4",
"Version": "1.4.5",
"Language": "csharp",
"Website": "https://github.com/KrystianLesniak/Flow.Launcher.Plugin.GamesLauncher",
"IcoPath": "icon.png",
Expand Down

0 comments on commit d6dadb5

Please sign in to comment.