Пример #1
0
        public override void Run(ProcessModel processModel)
        {
            bool isValidate;

            do
            {
                Console.Write(ConsoleSentences);
                EnterValue = Console.ReadLine().TrimStart().TrimEnd();

                isValidate = Validate();
                if (isValidate)
                {
                    processModel.PlateauModel = new PlateauModel()
                    {
                        Apsis    = Convert.ToInt32(EnterValue.Split(" ")[0]),
                        Ordinate = Convert.ToInt32(EnterValue.Split(" ")[1]),
                    };

                    processModel.RoverModels = new Queue <RoverModel>();
                    processModel.RoverIndex  = 1;

                    if (NextProcess != null)
                    {
                        NextProcess.Run(processModel);
                    }
                }
            } while (!isValidate);
        }
        public override bool Validate()
        {
            try
            {
                EnterValue.IsAllInfosEntered(3);

                _apsisValue = EnterValue.Split(" ")[0];
                _apsisValue.IsInRange(_processModel.PlateauModel.Apsis);

                _ordinateValue = EnterValue.Split(" ")[1];
                _ordinateValue.IsInRange(_processModel.PlateauModel.Ordinate);

                _orientationValue = EnterValue.Split(" ")[2];
                _orientationValue.HasContainsOrientationLetters();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Oops ? --> Values not valid ! Exception Message : {ex.Message} ");
                Console.WriteLine("------------Please Try Again-----------------------");
                return(false);
            }

            return(true);
        }