/// <summary> /// Create a new standard console /// </summary> /// <param name="colorize"> /// When true, errors and warnings are colorized in the output. When false, all output is /// monochrome. /// </param> /// <param name="animateTaskbar"> /// When true, BuildXL animates its taskbar icon during execution. /// </param> /// <param name="supportsOverwriting"> /// When true, messages printed to the console may be updated in-place (if supported) /// </param> /// <param name="pathTranslator"> /// The object to use to translate paths from one root to another (if specified) /// </param> public StandardConsole(bool colorize, bool animateTaskbar, bool supportsOverwriting, PathTranslator pathTranslator = null) { m_defaultForegroundColor = Console.ForegroundColor; // If any output is redirected, updating the cursor position won't work. We assume the output won't get // redirected after the process starts. m_updatingConsole = !Console.IsOutputRedirected && !Console.IsErrorRedirected && supportsOverwriting; m_pathTranslator = pathTranslator; if (colorize) { m_errorColor = ConsoleColor.Red; m_warningColor = ConsoleColor.Yellow; } else { m_errorColor = m_warningColor = m_defaultForegroundColor; } if (animateTaskbar) { m_taskbar = new TaskbarInterop(); m_taskbar.Init(); m_taskbar.SetTaskbarState(TaskbarInterop.TaskbarProgressStates.Normal); } var debugConsole = Environment.GetEnvironmentVariable("BUILDXLDEBUGCONSOLE"); if (!string.IsNullOrWhiteSpace(debugConsole) && debugConsole != "0") { m_debugConsole = true; } }
/// <inheritdoc /> public void Dispose() { lock (m_lock) { if (!m_isDisposed) { if (m_taskbar != null) { m_taskbar.SetTaskbarState(TaskbarInterop.TaskbarProgressStates.NoProgress); m_taskbar.Dispose(); m_taskbar = null; } } m_isDisposed = true; } }