Ejemplo n.º 1
0
        public GameSettingsDataModel()
        {
            Validator = new GameSettingsValidator();

            this.WhenAnyValue(x => x.DefaultDirectory)
            .Where(x => string.IsNullOrWhiteSpace(Directory) && !string.IsNullOrWhiteSpace(x))
            .Subscribe(x => { Directory = x; });
        }
Ejemplo n.º 2
0
        private static void ValidateGameSettings(GameSettings gameSettings)
        {
            if (gameSettings == null)
            {
                throw new Exception("Settings file is empty.");
            }

            var gameSettingsValidator = new GameSettingsValidator();
            var results = gameSettingsValidator.Validate(gameSettings);

            if (!results.IsValid)
            {
                throw new Exception($"Game Settings file is invalid:\n{results.BuildErrorMessage()}");
            }
        }
Ejemplo n.º 3
0
 public GameSettingsValidatorTests()
 {
     _gameSettingsValidator = new GameSettingsValidator();
     _exitPositionValidator = new ExitPositionValidator(5, 5);
 }