Esempio n. 1
0
        public void Run()
        {
            string input = Console.ReadLine();

            while (input != "End")
            {
                try
                {
                    string[] inputArgs = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);


                    string result = commandInterpreter.Read(animalCentre, inputArgs);

                    Console.WriteLine(result);
                }
                catch (TargetInvocationException tie)
                {
                    Console.WriteLine($"{tie.InnerException.InnerException.GetType().Name}: " + tie.InnerException.InnerException.Message);
                }

                input = Console.ReadLine();
            }

            string adoptedAnimals = animalCentre.AllAdoptedAnimals();

            Console.WriteLine(adoptedAnimals);
        }