Skip to content

Commit 567d251

Browse files
Merge pull request #40 from KrystianLesniak/develop
Release: 1.7.0
2 parents c167d0e + f60a9a7 commit 567d251

File tree

19 files changed

+235
-70
lines changed

19 files changed

+235
-70
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
***
66

7-
GamesLauncher is a plugin for [Flow launcher](https://github.com/Flow-Launcher/Flow.Launcher) that simplifies the process of searching for and launching games from multiple libraries. It provides quick and convenient access to your favorite games across various platforms, including Steam, Epic Games, Xbox, Amazon, and more libraries to come.
7+
GamesLauncher is a plugin for [Flow launcher](https://github.com/Flow-Launcher/Flow.Launcher) that simplifies the process of searching for and launching games from multiple libraries. It provides quick and convenient access to your favorite games across various platforms, including Steam, Epic Games, Xbox, and more.
88

99
![Capture](docs/capture.gif)
1010

@@ -16,6 +16,7 @@ GamesLauncher is a plugin for [Flow launcher](https://github.com/Flow-Launcher/F
1616
* Steam
1717
* Epic Games Launcher
1818
* Xbox
19+
* Ubisoft Connect
1920
* Amazon Games
2021
* [Custom Shortcuts](#custom-shortcuts)
2122

src/GamesLauncher.Common/Settings/MainSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ public class MainSettings
66
public bool SynchronizeSteam { get; set; } = true;
77
public bool SynchronizeXbox { get; set; } = true;
88
public bool SynchronizeAmazon { get; set; } = true;
9+
public bool SynchronizeUbisoft { get; set; } = true;
910
}
1011
}

src/GamesLauncher.Platforms/Game.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
using Flow.Launcher.Plugin;
2-
using static Flow.Launcher.Plugin.Result;
32

43
namespace GamesLauncher.Platforms
54
{
6-
public class Game
5+
public class Game : Result
76
{
7+
public new string SubTitle => Platform;
8+
89
internal Game(string title,
9-
Func<ActionContext, ValueTask<bool>> runTask,
10-
string? iconPath,
11-
IconDelegate? iconDelegate,
1210
string platform,
11+
Func<Task> runTask,
12+
string? iconPath,
13+
IconDelegate? iconDelegate = null,
1314
UninstallAction? uninstallAction = null)
1415
{
1516
Title = title;
1617
RunTask = runTask;
17-
IconPath = iconPath;
18-
IconDelegate = iconDelegate;
18+
IcoPath = iconPath;
19+
Icon = iconDelegate;
1920
Platform = platform;
2021
UninstallAction = uninstallAction;
2122
}
22-
23-
public string Title { get; }
24-
public Func<ActionContext, ValueTask<bool>> RunTask { get; }
23+
public string InternalGameId => $"{Platform}_{Title}";
24+
public Func<Task> RunTask { get; set; }
2525
public UninstallAction? UninstallAction { get; }
26-
public string? IconPath { get; }
27-
public IconDelegate? IconDelegate { get; }
2826
public string Platform { get; }
29-
public string InternalGameId => $"{Platform}_{Title}";
3027

3128
}
3229

src/GamesLauncher.Platforms/GamesLauncher.Platforms.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net7.0-windows</TargetFramework>
@@ -34,6 +34,9 @@
3434
<None Update="Icons\steam.png">
3535
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
3636
</None>
37+
<None Update="Icons\ubisoft.ico">
38+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
39+
</None>
3740
<None Update="Icons\xbox.png">
3841
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
3942
</None>
191 KB
Binary file not shown.

src/GamesLauncher.Platforms/PlatformsManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
using GamesLauncher.Common.Settings;
33
using GamesLauncher.Platforms.SyncEngines;
44
using GamesLauncher.Platforms.SyncEngines.Amazon;
5+
using GamesLauncher.Platforms.SyncEngines.Common.Interfaces;
56
using GamesLauncher.Platforms.SyncEngines.Epic;
67
using GamesLauncher.Platforms.SyncEngines.Steam;
8+
using GamesLauncher.Platforms.SyncEngines.Ubisoft;
79
using System.Diagnostics;
810

911
namespace GamesLauncher.Platforms
@@ -39,11 +41,6 @@ await Parallel.ForEachAsync(Engines, async (engine, ct) =>
3941
#endif
4042
}
4143

42-
public Game? GetGame(string title, string platform)
43-
{
44-
return AllSynchronizedGames.FirstOrDefault(x => x.Title == title && x.Platform == platform);
45-
}
46-
4744
private IEnumerable<ISyncEngine> InitializeEngines(MainSettings settings)
4845
{
4946
var engines = new List<ISyncEngine>();
@@ -57,6 +54,9 @@ private IEnumerable<ISyncEngine> InitializeEngines(MainSettings settings)
5754
if (settings.SynchronizeSteam)
5855
engines.Add(new SteamSyncEngine(publicApi));
5956

57+
if (settings.SynchronizeUbisoft)
58+
engines.Add(new UbisoftSyncEngine(publicApi));
59+
6060
if (settings.SynchronizeAmazon)
6161
engines.Add(new AmazonSyncEngine(publicApi));
6262

src/GamesLauncher.Platforms/SyncEngines/Amazon/AmazonSyncEngine.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Flow.Launcher.Plugin;
22
using GamesLauncher.Platforms.SyncEngines.Amazon.Readers;
3+
using GamesLauncher.Platforms.SyncEngines.Common.Interfaces;
34
using System.Collections.Concurrent;
45

56
namespace GamesLauncher.Platforms.SyncEngines.Amazon
@@ -39,15 +40,15 @@ public async Task SynchronizeGames()
3940
}
4041

4142

42-
private Func<ActionContext, ValueTask<bool>> GetGameRunTask(string gameAppIdString)
43+
private Func<Task> GetGameRunTask(string gameAppIdString)
4344
{
4445
var uriString = "amazon-games://play/" + gameAppIdString;
4546

46-
return (context) =>
47+
return () =>
4748
{
4849
publicApi.OpenAppUri(new Uri(uriString));
4950

50-
return ValueTask.FromResult(true);
51+
return Task.CompletedTask;
5152
};
5253
}
5354
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using GamesLauncher.Platforms.SyncEngines.Common.ControlPanelUninstall.Models;
2+
using Microsoft.Win32;
3+
using System.Collections.Concurrent;
4+
5+
namespace GamesLauncher.Platforms.SyncEngines.Common.ControlPanelUninstall
6+
{
7+
internal static class ControlPanelUninstall
8+
{
9+
internal static async Task<IEnumerable<UninstallProgram>> GetPrograms()
10+
{
11+
var programs = new ConcurrentBag<UninstallProgram>();
12+
13+
var registryHives = new RegistryHive[] { RegistryHive.LocalMachine, RegistryHive.CurrentUser };
14+
var registryViews = new RegistryView[] { RegistryView.Registry32, RegistryView.Registry64 };
15+
16+
await Parallel.ForEachAsync(registryHives, async (hive, ct) =>
17+
{
18+
await Parallel.ForEachAsync(registryViews, async (view, ct) =>
19+
{
20+
SearchPrograms(hive, view, programs);
21+
await Task.CompletedTask;
22+
});
23+
});
24+
25+
return programs;
26+
27+
28+
static void SearchPrograms(RegistryHive hive, RegistryView view, ConcurrentBag<UninstallProgram> programs)
29+
{
30+
const string uninstallRootKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\";
31+
32+
using var baseKey = RegistryKey.OpenBaseKey(hive, view);
33+
34+
using var uninstallSubKey = baseKey.OpenSubKey(uninstallRootKey);
35+
if (uninstallSubKey == null)
36+
return;
37+
38+
foreach (var programUninstallSubKeyName in uninstallSubKey.GetSubKeyNames())
39+
{
40+
try
41+
{
42+
using var prog = baseKey.OpenSubKey(uninstallRootKey + programUninstallSubKeyName);
43+
if (prog == null)
44+
continue;
45+
46+
programs.Add(new UninstallProgram()
47+
{
48+
DisplayIcon = prog.GetValue("DisplayIcon")?.ToString(),
49+
DisplayName = prog.GetValue("DisplayName")?.ToString() ?? string.Empty,
50+
UninstallCommand = prog.GetValue("UninstallString")?.ToString(),
51+
SubKeyName = programUninstallSubKeyName
52+
});
53+
}
54+
catch (System.Security.SecurityException)
55+
{
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace GamesLauncher.Platforms.SyncEngines.Common.ControlPanelUninstall.Models
2+
{
3+
internal class UninstallProgram
4+
{
5+
public string DisplayName { get; internal set; } = string.Empty;
6+
public string SubKeyName { get; internal set; } = string.Empty;
7+
public string? DisplayIcon { get; internal set; }
8+
public string? UninstallCommand { get; internal set; }
9+
}
10+
}

src/GamesLauncher.Platforms/SyncEngines/ISyncEngine.cs renamed to src/GamesLauncher.Platforms/SyncEngines/Common/Interfaces/ISyncEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace GamesLauncher.Platforms.SyncEngines;
1+
namespace GamesLauncher.Platforms.SyncEngines.Common.Interfaces;
22

33
internal interface ISyncEngine
44
{

0 commit comments

Comments
 (0)