account for different Epic manifest paths

This commit is contained in:
pointfeev 2022-03-24 23:13:33 -04:00
parent f7b484f1f3
commit 20666fd7a5
3 changed files with 13 additions and 10 deletions

View file

@ -5,7 +5,7 @@
<UseWindowsForms>True</UseWindowsForms> <UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon> <ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>3.4.0.3</Version> <Version>3.4.0.4</Version>
<PackageIcon>Resources\ini.ico</PackageIcon> <PackageIcon>Resources\ini.ico</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright> <Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>

View file

@ -11,22 +11,25 @@ namespace CreamInstaller.Epic;
internal static class EpicLibrary internal static class EpicLibrary
{ {
private static string epicAppDataPath; private static string epicManifestsPath;
internal static string EpicAppDataPath internal static string EpicManifestsPath
{ {
get get
{ {
epicAppDataPath ??= Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Epic Games\EpicGamesLauncher", "AppDataPath", null) as string; epicManifestsPath ??= Registry.GetValue(@"HKEY_CURRENT_USER\Software\Epic Games\EOS", "ModSdkMetadataDir", null) as string;
epicAppDataPath ??= Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Epic Games\EpicGamesLauncher", "AppDataPath", null) as string; epicManifestsPath ??= Registry.GetValue(@"HKEY_CURRENT_USER\Software\Wow6432Node\Epic Games\EOS", "ModSdkMetadataDir", null) as string;
return epicAppDataPath; epicManifestsPath ??= Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Epic Games\EpicGamesLauncher", "AppDataPath", null) as string;
epicManifestsPath ??= Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Epic Games\EpicGamesLauncher", "AppDataPath", null) as string;
if (epicManifestsPath.EndsWith(@"\Data")) epicManifestsPath += @"\Manifests";
return epicManifestsPath;
} }
} }
internal static async Task<List<Manifest>> GetGames() => await Task.Run(() => internal static async Task<List<Manifest>> GetGames() => await Task.Run(() =>
{ {
List<Manifest> games = new(); List<Manifest> games = new();
if (!Directory.Exists(EpicAppDataPath)) return games; if (!Directory.Exists(EpicManifestsPath)) return games;
string manifests = EpicAppDataPath + @"\Manifests"; string manifests = EpicManifestsPath;
if (!Directory.Exists(manifests)) return games; if (!Directory.Exists(manifests)) return games;
string[] files = Directory.GetFiles(manifests, "*.item"); string[] files = Directory.GetFiles(manifests, "*.item");
foreach (string file in files) foreach (string file in files)

View file

@ -260,7 +260,7 @@ internal partial class SelectForm : CustomForm
appTasks.Add(task); appTasks.Add(task);
} }
} }
if (Directory.Exists(EpicLibrary.EpicAppDataPath) && ProgramsToScan.Any(c => c.platform == "Epic")) if (Directory.Exists(EpicLibrary.EpicManifestsPath) && ProgramsToScan.Any(c => c.platform == "Epic"))
{ {
List<Manifest> epicGames = await EpicLibrary.GetGames(); List<Manifest> epicGames = await EpicLibrary.GetGames();
foreach (Manifest manifest in epicGames) foreach (Manifest manifest in epicGames)
@ -417,7 +417,7 @@ internal partial class SelectForm : CustomForm
foreach (Tuple<string, string, string, int, string> program in await SteamLibrary.GetGames()) foreach (Tuple<string, string, string, int, string> program in await SteamLibrary.GetGames())
if (!Program.IsGameBlocked(program.Item1, program.Item5)) if (!Program.IsGameBlocked(program.Item1, program.Item5))
gameChoices.Add(("Steam", program.Item1, program.Item2, ProgramsToScan is not null && ProgramsToScan.Any(p => p.id == program.Item1))); gameChoices.Add(("Steam", program.Item1, program.Item2, ProgramsToScan is not null && ProgramsToScan.Any(p => p.id == program.Item1)));
if (Directory.Exists(EpicLibrary.EpicAppDataPath)) if (Directory.Exists(EpicLibrary.EpicManifestsPath))
foreach (Manifest manifest in await EpicLibrary.GetGames()) foreach (Manifest manifest in await EpicLibrary.GetGames())
if (!Program.IsGameBlocked(manifest.DisplayName, manifest.InstallLocation)) if (!Program.IsGameBlocked(manifest.DisplayName, manifest.InstallLocation))
gameChoices.Add(("Epic", manifest.CatalogNamespace, manifest.DisplayName, ProgramsToScan is not null && ProgramsToScan.Any(p => p.id == manifest.CatalogNamespace))); gameChoices.Add(("Epic", manifest.CatalogNamespace, manifest.DisplayName, ProgramsToScan is not null && ProgramsToScan.Any(p => p.id == manifest.CatalogNamespace)));