Пример #1
0
        public IEnumerable <GameInstallation> FindInstallations(IGameDefinition game)
        {
            String path = Environment.GetEnvironmentVariable(game.Identifier.ToUpperInvariant() + "_PATH");

            if (path == null)
            {
                return new GameInstallation[] {}
            }
            ;

            var installations = new GameInstallation[] { new GameInstallation(game, path) };

            return(installations);
        }
    }
Пример #2
0
        public IEnumerable <GameInstallation> FindInstallations(IGameDefinition game)
        {
            var identifier = game.Identifier.ToUpperInvariant() + "_PATH";
            var path       = Environment.GetEnvironmentVariable(identifier);

            if (path == null)
            {
                path = Environment.GetEnvironmentVariable(identifier, EnvironmentVariableTarget.User);
            }
            if (path == null || !Directory.Exists(path))
            {
                return(new GameInstallation[] {});
            }

            var installations = new GameInstallation[] { new GameInstallation(game, path) };

            return(installations);
        }
Пример #3
0
        public IEnumerable <GameInstallation> FindInstallations(IGameDefinition game)
        {
            GameInstallation baseGameInstallation = null;

            if (game.BaseGame != null)
            {
                // TODO: Allow selecting one of these?
                baseGameInstallation = FindInstallations(game.BaseGame).FirstOrDefault();

                if (baseGameInstallation == null)
                {
                    logger.Warn("No game installations found");
                    return(Enumerable.Empty <GameInstallation>());
                }
            }

            var paths = game.RegistryKeys.Select(RegistryUtility.GetRegistryValue);

            var installations = GetValidPaths(paths)
                                .Select(p => new GameInstallation(game, p, baseGameInstallation))
                                .ToList();

            return(installations);
        }
Пример #4
0
 public GameInstallation(IGameDefinition game, string path, GameInstallation baseGame = null)
 {
     Game = game;
     Path = path;
     _baseGameInstallation = baseGame;
 }