public virtual IDisposable WriteBlock(string text) { Info(FigletTransform.GetText(text)); return(DelegateDisposable.CreateBracket( () => Console.Title = $"Executing: {text}", () => Console.Title = $"Finished: {text}")); }
private static IDisposable SwitchSecurityProtocol() { var previousProtocol = ServicePointManager.SecurityProtocol; return(DelegateDisposable.CreateBracket( () => ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12, () => ServicePointManager.SecurityProtocol = previousProtocol)); }
public static IDisposable WriteBlock(this CustomFileWriter writer, string text) { return(DelegateDisposable .CreateBracket( () => writer.WriteLine(string.IsNullOrWhiteSpace(text) ? "{" : $"{text} {{"), () => writer.WriteLine("}")) .CombineWith(writer.Indent())); }
private void WriteWithColors(string text, ConsoleColor foregroundColor) { var previousForegroundColor = Console.ForegroundColor; using (DelegateDisposable.CreateBracket( () => Console.ForegroundColor = foregroundColor, () => Console.ForegroundColor = previousForegroundColor)) { Console.WriteLine(text); } }
public CapturedProcessStartInfo CaptureProcessStartInfo(Action action) { var fakeProcessManager = new CapturingProcessManager(); using (DelegateDisposable.CreateBracket( () => Instance = fakeProcessManager, () => Instance = this)) { action(); return(fakeProcessManager.CapturedProcessStartInfo); } }
IDisposable SwitchWorkingDirectory(string workingDirectory, bool allowCreate = true) { if (!Directory.Exists(workingDirectory)) { EnsureCleanDirectory(workingDirectory); } var previousWorkingDirectory = EnvironmentInfo.WorkingDirectory; return(DelegateDisposable.CreateBracket( () => Directory.SetCurrentDirectory(workingDirectory), () => Directory.SetCurrentDirectory(previousWorkingDirectory))); }
private void WriteWithColors(string text, ConsoleColor brightForeground, ConsoleColor darkForeground) { var previousForeground = Console.ForegroundColor; var backgroundColor = Console.BackgroundColor; var hasDarkBackground = backgroundColor == ConsoleColor.Black || backgroundColor.ToString().StartsWith("Dark"); using (DelegateDisposable.CreateBracket( () => Console.ForegroundColor = hasDarkBackground ? brightForeground : darkForeground, () => Console.ForegroundColor = previousForeground)) { Console.WriteLine(text); } }
public virtual IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => { var formattedBlockText = FormatBlockText(text) .Split(new[] { EnvironmentInfo.NewLine }, StringSplitOptions.None); Console.WriteLine(); Console.WriteLine("╬" + new string(c: '═', text.Length + 5)); formattedBlockText.ForEach(x => Console.WriteLine($"║ {x}")); Console.WriteLine("╬" + new string(c: '═', Math.Max(text.Length - 4, 2))); Console.WriteLine(); })); }
protected internal virtual IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => { var formattedBlockText = text .Split(new[] { EnvironmentInfo.NewLine }, StringSplitOptions.None) .Select(Theme.FormatInformation); Debug(); Debug("╬" + new string(c: '═', text.Length + 5)); formattedBlockText.ForEach(x => Debug($"║ {x}")); Debug("╬" + new string(c: '═', Math.Max(text.Length - 4, 2))); Debug(); })); }
internal override IDisposable WriteBlock(string text) { var stopWatch = new Stopwatch(); return(DelegateDisposable.CreateBracket( () => { _teamCity.OpenBlock(text); stopWatch.Start(); }, () => { _teamCity.CloseBlock(text); _teamCity.AddStatisticValue( $"NUKE_DURATION_{text.SplitCamelHumpsWithSeparator("_").ToUpper()}", stopWatch.ElapsedMilliseconds.ToString()); stopWatch.Stop(); })); }
internal override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => _azurePipelines.Group(text), () => _azurePipelines.EndGroup(text))); }
internal override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => WriteNormal(FigletTransform.GetText(text, "ansi-shadow")))); }
protected internal override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket()); }
public override IDisposable WriteBlock(string text) { Info(FigletTransform.GetText(text, "ansi-shadow")); return(DelegateDisposable.CreateBracket()); }
public override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => _teamCity.OpenBlock(text), () => _teamCity.CloseBlock(text))); }
public static IDisposable SetTargetEventProperty(string name) { return(DelegateDisposable.CreateBracket( () => s_property = GetTargetEventProperty(name), () => s_property = null)); }
internal override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => _githubActions.Group(text), () => _githubActions.EndGroup(text))); }
internal override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => Console.WriteLine($"travis_fold:start:{text}"), () => Console.WriteLine($"travis_fold:end:{text}"))); }
public static IDisposable WriteBlock(this CustomFileWriter writer, string text) { return(DelegateDisposable .CreateBracket(() => writer.WriteLine(text)) .CombineWith(writer.Indent())); }
internal override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => _gitlab.BeginSection(text), () => _gitlab.EndSection(text))); }
protected internal override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => Group(text), () => EndGroup(text))); }
protected internal override IDisposable WriteBlock(string text) { return(DelegateDisposable.CreateBracket( () => OpenBlock(text), () => CloseBlock(text))); }