Пример #1
0
        public override bool Execute(List<string> args)
        {
            if (args.Count < 2)
                return false;

            var cargs = new List<string>();
            if (args.Count > 2)
            {
                for (var i = 2; i < args.Count; i++)
                    cargs.Add(args[i]);
            }

            if (args[0][0] == 'c' || args[0][0] == 'C')
            {
                for (var i = 0; i < int.Parse(args[0].Substring(1)); i++)
                {
                    Console.WriteLine("execute command '" + args[1] + " " + cargs.VerboseCombine(" ", a => a) + "' for the " + i + " time");
                    CommandManager.Instance().ExecuteCommand(args[1], cargs);
                    Console.WriteLine();
                }
            }
            else if (args[0][0] == 'i' || args[0][0] == 'I')
            {
                var seconds = int.Parse(args[0].Substring(1));
                while (true)
                {
                    Console.WriteLine(DateTime.Now.ToLongTimeString() + ": execute command '" + args[1] + " " + cargs.VerboseCombine(" ", a => a) + "'");
                    CommandManager.Instance().ExecuteCommand(args[1], cargs);
                    Console.WriteLine();
                    Thread.Sleep(seconds * 1000);
                }
            }
            else
                return false;

            return true;
        }
Пример #2
0
        public override bool Execute(List <string> args)
        {
            if (args.Count < 2)
            {
                return(false);
            }

            var cargs = new List <string>();

            if (args.Count > 2)
            {
                for (var i = 2; i < args.Count; i++)
                {
                    cargs.Add(args[i]);
                }
            }

            if (args[0][0] == 'c' || args[0][0] == 'C')
            {
                for (var i = 0; i < int.Parse(args[0].Substring(1)); i++)
                {
                    Console.WriteLine("execute command '" + args[1] + " " + cargs.VerboseCombine(" ", a => a) + "' for the " + i + " time");
                    CommandManager.Instance().ExecuteCommand(args[1], cargs);
                    Console.WriteLine();
                }
            }
            else if (args[0][0] == 'i' || args[0][0] == 'I')
            {
                var seconds = int.Parse(args[0].Substring(1));
                while (true)
                {
                    Console.WriteLine(DateTime.Now.ToLongTimeString() + ": execute command '" + args[1] + " " + cargs.VerboseCombine(" ", a => a) + "'");
                    CommandManager.Instance().ExecuteCommand(args[1], cargs);
                    Console.WriteLine();
                    Thread.Sleep(seconds * 1000);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
 public override bool Execute(List <string> args)
 {
     Console.WriteLine(SystemHelper.RunCommand(args.VerboseCombine(" ", a => a)));
     return(true);
 }
Пример #4
0
 public override bool Execute(List<string> args)
 {
     Console.WriteLine(SystemHelper.RunCommand(args.VerboseCombine(" ", a => a)));
     return true;
 }