ubisoft game executables attempt #2

This commit is contained in:
pointfeev 2022-08-25 19:20:06 -04:00
parent f66844d8d0
commit ff6ee8518f

View file

@ -432,17 +432,13 @@ internal partial class SelectForm : CustomForm
selection.Id = gameId; selection.Id = gameId;
selection.Name = name; selection.Name = name;
selection.RootDirectory = gameDirectory; selection.RootDirectory = gameDirectory;
// need a better method for obtaining ubisoft game executables // need a solid method for obtaining ubisoft game executables (below is likely temporary)
// for now, I just get the largest (file size) single executable selection.ExecutableDirectories = (await selection.RootDirectory
string largestExecutableDirectory = null; .GetExecutables(d =>
long largestExecutableDirectorySize = 0;
foreach (string path in await selection.RootDirectory.GetExecutables())
if (new FileInfo(path).Length is long executableSize && executableSize > largestExecutableDirectorySize)
{ {
largestExecutableDirectory = Path.GetDirectoryName(path); string subPath = d[selection.RootDirectory.Length..].ToUpperInvariant();
largestExecutableDirectorySize = executableSize; return !subPath.Contains("SETUP") && !subPath.Contains("REDIST");
} })).Select(e => e = Path.GetDirectoryName(e)).Distinct().ToList();
selection.ExecutableDirectories = new() { largestExecutableDirectory ?? selection.RootDirectory };
selection.DllDirectories = dllDirectories; selection.DllDirectories = dllDirectories;
selection.Platform = Platform.Ubisoft; selection.Platform = Platform.Ubisoft;
selection.IconUrl = IconGrabber.GetDomainFaviconUrl("store.ubi.com"); selection.IconUrl = IconGrabber.GetDomainFaviconUrl("store.ubi.com");