예제 #1
0
파일: Runner.cs 프로젝트: AMDL/amdl2maml
 public Runner(Parameters parameters, CancellationToken cancellationToken, TextWriter writer)
     : base(parameters, writer, cancellationToken)
 {
     this.stepProgress = new Progress<Indicator>();
 }
예제 #2
0
 private static string GetTimeFormat(Parameters parameters)
 {
     return Reformat(parameters.TimeFormat);
 }
예제 #3
0
 protected RunnerBase(Parameters parameters, TextWriter writer, CancellationToken cancellationToken)
     : this(parameters.Verbosity, GetFormats(parameters), writer, cancellationToken, new Progress<Indicator>(), new SemaphoreSlim(1))
 {
 }
예제 #4
0
 private static string GetStepPrologueFormat(Parameters parameters)
 {
     return parameters.Verbosity == Verbosity.Insane
         ? " STEP {1}/{2} {0}"
         : " {0}";
 }
예제 #5
0
 private static string GetStepProgressFormat(Parameters parameters)
 {
     return parameters.Verbosity == Verbosity.Insane
         ? "{0}  {1:000.00}%  "
         : "{0}  ";
 }
예제 #6
0
 private static string GetStepEpilogueFormat(Parameters parameters)
 {
     return parameters.Verbosity == Verbosity.Insane
         ? " FINISHED {1}IN {0}"
         : " {1}FINISHED IN {0}";
 }
예제 #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),
     };
 }
예제 #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;
 }