コード例 #1
0
        /// <summary>
        /// Get file and fill the objects.
        /// </summary>
        /// <param name="filePath">It is the game settings file path</param>
        public GameContext PopulateGameSettings(string filePath)
        {
            if (filePath.Equals(string.Empty))
            {
                return(null);
            }
            var lines = _readDataService.GetLines(filePath);

            var game = new GameContext
            {
                GameSize        = GetGameSize(_readDataService.GetNumbers(lines[0])),
                MineCoordinates = GetMineCoordinates(lines[1]),
                ExitPoint       = GetExitPoint(_readDataService.GetNumbers(lines[2])),
                StartPosition   = GetStartPosition(lines[3]),
                CommandList     = GetGameCommandList(filePath)
            };

            return(game);
        }