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>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>3.4.0.3</Version>
<Version>3.4.0.4</Version>
<PackageIcon>Resources\ini.ico</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>

View file

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

View file

@ -260,7 +260,7 @@ internal partial class SelectForm : CustomForm
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();
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())
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)));
if (Directory.Exists(EpicLibrary.EpicAppDataPath))
if (Directory.Exists(EpicLibrary.EpicManifestsPath))
foreach (Manifest manifest in await EpicLibrary.GetGames())
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)));