示例#1
0
        public override void Execute(params string[] parameters)
        {
            // Read all the file before we execute the commands,
            // the handling may take along time and we don't want
            // to keep the stream active for too long
            var commands = File.ReadAllLines(GetPath(parameters)).ToList();

            commands.ForEach(command =>
            {
                Console.WriteLine("Executing \"{0}\"", command);
                CommandsRunner.GetInstance().HandleCommand(command);
            });
        }
示例#2
0
        public override void Execute(params string[] parameters)
        {
            Console.WriteLine("The supported commands are:");
            foreach (var commandsDictionaryValue in CommandsRunner.GetInstance().CommandsDictionary.Values)
            {
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine(commandsDictionaryValue.CommandName);
                Console.ResetColor();
                Console.WriteLine(commandsDictionaryValue.Description);

                if (commandsDictionaryValue.Parameters.Any())
                {
                    Console.WriteLine("Parameters:");
                    commandsDictionaryValue.Parameters.ForEach(parameter =>
                    {
                        Console.WriteLine("- {0} {1}", parameter.Index, parameter.Name);
                    });
                }
            }
        }