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}");
            }
        }
Beispiel #2
0
        private static IEnumerable <GameInstallation> FindInstallations()
        {
            var locator = new RegistryInstallationLocator();

            return(SageGames.GetAll()
                   .SelectMany(locator.FindInstallations));
        }
Beispiel #3
0
        static GameTestDiscoverer()
        {
            var locator = new RegistryInstallationLocator();

            InstalledGames = SageGames.GetAll().Where(game => locator.FindInstallations(game).Any()).ToSet();
        }