Beispiel #1
0
 public Runner(Parameters parameters, CancellationToken cancellationToken, TextWriter writer)
     : base(parameters, writer, cancellationToken)
 {
     this.stepProgress = new Progress<Indicator>();
 }
Beispiel #2
0
 private static string GetTimeFormat(Parameters parameters)
 {
     return Reformat(parameters.TimeFormat);
 }
Beispiel #3
0
 protected RunnerBase(Parameters parameters, TextWriter writer, CancellationToken cancellationToken)
     : this(parameters.Verbosity, GetFormats(parameters), writer, cancellationToken, new Progress<Indicator>(), new SemaphoreSlim(1))
 {
 }
Beispiel #4
0
 private static string GetStepPrologueFormat(Parameters parameters)
 {
     return parameters.Verbosity == Verbosity.Insane
         ? " STEP {1}/{2} {0}"
         : " {0}";
 }
Beispiel #5
0
 private static string GetStepProgressFormat(Parameters parameters)
 {
     return parameters.Verbosity == Verbosity.Insane
         ? "{0}  {1:000.00}%  "
         : "{0}  ";
 }
Beispiel #6
0
 private static string GetStepEpilogueFormat(Parameters parameters)
 {
     return parameters.Verbosity == Verbosity.Insane
         ? " FINISHED {1}IN {0}"
         : " {1}FINISHED IN {0}";
 }
Beispiel #7
0
 private static Formats GetFormats(Parameters parameters)
 {
     return new Formats
     {
         Time = GetTimeFormat(parameters),
         Duration = GetDurationFormat(parameters),
         StepPrologue = GetStepPrologueFormat(parameters),
         StepEpilogue = GetStepEpilogueFormat(parameters),
         StepProgress = GetStepProgressFormat(parameters),
     };
 }
Beispiel #8
0
 private static string GetDurationFormat(Parameters parameters)
 {
     var init = parameters.DurationFormat.Trim();
     var split = parameters.DurationFormat.Split(':', '.', ',', '-', '/', ' ');
     int index = 0;
     string durationFormat = null;
     foreach (var s in split)
     {
         if (!string.IsNullOrEmpty(s))
         {
             durationFormat += Reformat(s);
             index += s.Length;
         }
         if (index < init.Length - 1)
             durationFormat += init[index++];
     }
     return durationFormat;
 }