Ejemplo n.º 1
0
        public void PrintToConsole(CronResult cronResult)
        {
            foreach (var expressionResult in cronResult.ExpressionResults)
            {
                Console.Write($"{expressionResult.ExpressionName, -NamePadding} ");
                foreach (int value in expressionResult.Values)
                {
                    Console.Write($"{value} ");
                }
                Console.WriteLine();
            }

            Console.WriteLine($"{"Command", -NamePadding} {cronResult.Command}");
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args == null || args.Length != CronInterpreter.CommandPartsCount)
            {
                Console.WriteLine("Invalid command parameters.");
                return;
            }

            try
            {
                var        cronInterpreter = new CronInterpreter();
                CronResult cronResult      = cronInterpreter.Interpret(args);

                var cronPrinter = new CronPrinter();
                cronPrinter.PrintToConsole(cronResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }