Exemplo n.º 1
0
        public void Run()
        {
            IReader            reader            = this.serviceProvider.GetService <IReader>();
            IWriter            writer            = this.serviceProvider.GetService <IWriter>();
            ICommandDispatcher commandDispatcher = this.serviceProvider.GetService <ICommandDispatcher>();

            while (true)
            {
                string   input      = reader.ReadLine();
                string[] inputParts = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                try
                {
                    string result = commandDispatcher.ParseCommand(this.serviceProvider, inputParts);
                    writer.WriteLine(result);
                }
                catch (Exception e)
                {
                    writer.WriteLine(e.Message);
                }
            }
        }