Exemplo n.º 1
0
        public ICoordinate GetShotLocationManually()
        {
            try
            {
                while (true)
                {
                    _log.Info("BTG - Get the shot location manually!");

                    Console.Write("Which location do you want to shot? ");
                    _inputResult = Console.ReadLine();
                    if (_inputResult.Trim().Length > 1)
                    {
                        _xCoordinate = _helper.GetNumberFromLetter(_inputResult.Substring(0, 1));
                        if (_xCoordinate > 0 && int.TryParse(_inputResult.Substring(1), out _yCoordinate))
                        {
                            return(new Coordinate(_xCoordinate, _yCoordinate));
                        }

                        _outputManager.ShowInvalidInput();
                    }
                }
            }
            catch (Exception e)
            {
                _log.Error($"BTG - Error when trying to get the shot location from input: {e}");
            }

            return(null);
        }