public Runner(Parameters parameters, CancellationToken cancellationToken, TextWriter writer) : base(parameters, writer, cancellationToken) { this.stepProgress = new Progress<Indicator>(); }
private static string GetTimeFormat(Parameters parameters) { return Reformat(parameters.TimeFormat); }
protected RunnerBase(Parameters parameters, TextWriter writer, CancellationToken cancellationToken) : this(parameters.Verbosity, GetFormats(parameters), writer, cancellationToken, new Progress<Indicator>(), new SemaphoreSlim(1)) { }
private static string GetStepPrologueFormat(Parameters parameters) { return parameters.Verbosity == Verbosity.Insane ? " STEP {1}/{2} {0}" : " {0}"; }
private static string GetStepProgressFormat(Parameters parameters) { return parameters.Verbosity == Verbosity.Insane ? "{0} {1:000.00}% " : "{0} "; }
private static string GetStepEpilogueFormat(Parameters parameters) { return parameters.Verbosity == Verbosity.Insane ? " FINISHED {1}IN {0}" : " {1}FINISHED IN {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), }; }
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; }