fix subdirectories

This commit is contained in:
pointfeev 2023-01-29 23:49:36 -05:00
parent eec1e9821d
commit fa9d83d6d2
2 changed files with 11 additions and 6 deletions

View file

@ -172,6 +172,7 @@ internal sealed partial class SelectForm : CustomForm
if (dllDirectories is null) if (dllDirectories is null)
{ {
Interlocked.Decrement(ref steamGamesToCheck); Interlocked.Decrement(ref steamGamesToCheck);
DebugForm.Current.Log("no dll " + appId + " - " + name);
RemoveFromRemainingGames(name); RemoveFromRemainingGames(name);
return; return;
} }
@ -192,6 +193,7 @@ internal sealed partial class SelectForm : CustomForm
dlcIds.AddRange(await SteamStore.ParseDlcAppIds(appData)); dlcIds.AddRange(await SteamStore.ParseDlcAppIds(appData));
if (appInfo is not null) if (appInfo is not null)
dlcIds.AddRange(await SteamCMD.ParseDlcAppIds(appInfo)); dlcIds.AddRange(await SteamCMD.ParseDlcAppIds(appInfo));
dlcIds = dlcIds.Distinct().ToList();
if (dlcIds.Count > 0) if (dlcIds.Count > 0)
foreach (string dlcAppId in dlcIds) foreach (string dlcAppId in dlcIds)
{ {
@ -528,9 +530,9 @@ internal sealed partial class SelectForm : CustomForm
gameChoices.Add((Platform.Steam, appId, name, gameChoices.Add((Platform.Steam, appId, name,
programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Steam && p.id == appId))); programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Steam && p.id == appId)));
if (EpicLibrary.EpicManifestsPath.DirectoryExists()) if (EpicLibrary.EpicManifestsPath.DirectoryExists())
foreach (Manifest manifest in (await EpicLibrary.GetGames()).Where(m => !Program.IsGameBlocked(m.DisplayName, m.InstallLocation))) gameChoices.AddRange((await EpicLibrary.GetGames()).Where(m => !Program.IsGameBlocked(m.DisplayName, m.InstallLocation)).Select(manifest
gameChoices.Add((Platform.Epic, manifest.CatalogNamespace, manifest.DisplayName, => (Platform.Epic, manifest.CatalogNamespace, manifest.DisplayName,
programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Epic && p.id == manifest.CatalogNamespace))); programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Epic && p.id == manifest.CatalogNamespace))));
foreach ((string gameId, string name, string _) in (await UbisoftLibrary.GetGames()).Where(g => !Program.IsGameBlocked(g.name, g.gameDirectory))) foreach ((string gameId, string name, string _) in (await UbisoftLibrary.GetGames()).Where(g => !Program.IsGameBlocked(g.name, g.gameDirectory)))
gameChoices.Add((Platform.Ubisoft, gameId, name, gameChoices.Add((Platform.Ubisoft, gameId, name,
programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Ubisoft && p.id == gameId))); programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Ubisoft && p.id == gameId)));
@ -678,7 +680,7 @@ internal sealed partial class SelectForm : CustomForm
} }
} }
private List<TreeNode> GatherTreeNodes(TreeNodeCollection nodeCollection) private static List<TreeNode> GatherTreeNodes(TreeNodeCollection nodeCollection)
{ {
List<TreeNode> treeNodes = new(); List<TreeNode> treeNodes = new();
foreach (TreeNode rootNode in nodeCollection) foreach (TreeNode rootNode in nodeCollection)

View file

@ -89,12 +89,15 @@ internal static class SafeIO
return Enumerable.Empty<string>(); return Enumerable.Empty<string>();
} }
internal static IEnumerable<string> EnumerateSubdirectories(this string directoryPath, string directoryPattern, bool crucial = false, Form form = null) internal static IEnumerable<string> EnumerateSubdirectories(this string directoryPath, string directoryPattern, bool subdirectories = false,
bool crucial = false, Form form = null)
{ {
while (!Program.Canceled) while (!Program.Canceled)
try try
{ {
return Directory.EnumerateDirectories(directoryPath, directoryPattern); return subdirectories
? Directory.EnumerateDirectories(directoryPath, directoryPattern, new EnumerationOptions { RecurseSubdirectories = true })
: Directory.EnumerateDirectories(directoryPath, directoryPattern);
} }
catch catch
{ {