Exemplo n.º 1
0
        /// <summary>
        /// 安全写入方法。防止颜色冲突。
        /// </summary>
        /// <param name="text"></param>
        /// <param name="intensity"></param>
        protected void SafeWriteLine(string text, bool intensity = false, ConsoleColor?foregroundColor = null)
        {
            var oc = new SafeConsoleColor();
            var sc = new SafeConsoleColor(oc.BackgroundColor, foregroundColor ?? ForegroundColor, intensity);

            sc.SetToConsole();
            Console.WriteLine(text);
            oc.SetToConsole();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 安全写入方法。防止颜色冲突。
        /// </summary>
        /// <param name="text"></param>
        /// <param name="intensity"></param>
        protected void SafeWriteLine(string text, bool intensity)
        {
            var oc = new SafeConsoleColor();
            var f  = GetColor();
            var sc = new SafeConsoleColor(oc.BackgroundColor, f, intensity);

            sc.SetToConsole();
            Console.WriteLine(text);
            oc.SetToConsole();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 安全写入方法。防止颜色冲突。
        /// </summary>
        /// <param name="text"></param>
        protected void SafeWrite(string text)
        {
            var oc = new SafeConsoleColor();
            var f  = GetColor();
            var sc = new SafeConsoleColor(oc.BackgroundColor, f, false);

            sc.SetToConsole();
            Console.Write(text);
            oc.SetToConsole();
        }