public static void ReadFiles(string fileExtension, ITestOutputHelper output, Action <FileSystemEntry> processFileCallback) { var rootDirectories = SageGames.GetAll() .SelectMany(Locator.FindInstallations) .Select(i => i.Path); var foundAtLeastOneFile = false; foreach (var rootDirectory in rootDirectories.Where(x => Directory.Exists(x))) { var fileSystem = new FileSystem(rootDirectory); foreach (var file in fileSystem.Files) { if (Path.GetExtension(file.FilePath).ToLower() != fileExtension) { continue; } output.WriteLine($"Reading file {file.FilePath}."); processFileCallback(file); foundAtLeastOneFile = true; } } if (!foundAtLeastOneFile) { throw new Exception($"No files were found matching file extension {fileExtension}"); } }
private static IEnumerable <GameInstallation> FindInstallations() { var locator = new RegistryInstallationLocator(); return(SageGames.GetAll() .SelectMany(locator.FindInstallations)); }
static GameTestDiscoverer() { var locator = new RegistryInstallationLocator(); InstalledGames = SageGames.GetAll().Where(game => locator.FindInstallations(game).Any()).ToSet(); }