Exemplo n.º 1
0
        public static void DoStuff(ProgramOptions options)
        {
            Options = options;
            GlobalStopwatch = Stopwatch.StartNew();

            DumpSettings(Options);

            if (!Options.ShowTitles && Options.ShouldLog)
            {
                foreach (var output in Outputs)
                {
                    ConsoleExtensions.WriteLineColor(output.OutputColor, output.Name);
                }
            }

            Iterations = Options.NumberOfIterations;
            for (var i = 1; i <= Iterations; i++)
            {
                ConsoleExtensions.WriteLine($"Iteration {i}".ToUpper());

                foreach (var increment in Increments)
                {
                    RunIncrement(increment);
                }
            }
            GlobalStopwatch.Stop();
            if (Options.ShouldOutput) WriteOutputs(DateTime.UtcNow);
            if (Options.ShouldHaltOnEnd) ConsoleExtensions.WriteLine("DONE");
            if (Options.ShouldHaltOnEnd) Console.ReadLine();
        }
Exemplo n.º 2
0
 public static void DumpSettings(ProgramOptions options)
 {
     ConsoleExtensions.WriteLineColor(ConsoleColor.Green, "****** {0} ******", "CONFIGURATIONS");
     foreach (var prop in options.GetType().GetProperties())
     {
         ConsoleExtensions.WriteLine("{0} -> {1}", Regex.Replace(prop.Name, @"(\B[A-Z]+?(?=[A-Z][^A-Z])|\B[A-Z]+?(?=[^A-Z]))", " $1"), prop.GetValue(options, null));
     }
     ConsoleExtensions.WriteLineColor(ConsoleColor.Green, "****** {0} *****", new string('-', "CONFIGURATIONS".Length));
 }