Example #1
0
        protected void ProcessSGRParameterANSI(int code, ref TextDecoration dec)
        {
            switch (code)
            {
            case 0:     // default rendition (implementation-defined) (ECMA-48,VT100,VT220)
                dec = TextDecoration.Default;
                break;

            case 1:     // bold or increased intensity (ECMA-48,VT100,VT220)
                dec = dec.GetCopyWithBold(true);
                break;

            case 2:     // faint, decreased intensity or second colour (ECMA-48)
                break;

            case 3:     // italicized (ECMA-48)
                break;

            case 4:     // singly underlined (ECMA-48,VT100,VT220)
                dec = dec.GetCopyWithUnderline(true);
                break;

            case 5:     // slowly blinking (ECMA-48,VT100,VT220)
            case 6:     // rapidly blinking (ECMA-48)
                dec = dec.GetCopyWithBlink(true);
                break;

            case 7:     // negative image (ECMA-48,VT100,VT220)
                dec = dec.GetCopyWithInverted(true);
                break;

            case 8:     // concealed characters (ECMA-48,VT300)
            case 9:     // crossed-out (ECMA-48)
            case 10:    // primary (default) font (ECMA-48)
            case 11:    // first alternative font (ECMA-48)
            case 12:    // second alternative font (ECMA-48)
            case 13:    // third alternative font (ECMA-48)
            case 14:    // fourth alternative font (ECMA-48)
            case 15:    // fifth alternative font (ECMA-48)
            case 16:    // sixth alternative font (ECMA-48)
            case 17:    // seventh alternative font (ECMA-48)
            case 18:    // eighth alternative font (ECMA-48)
            case 19:    // ninth alternative font (ECMA-48)
            case 20:    // Fraktur (Gothic) (ECMA-48)
            case 21:    // doubly underlined (ECMA-48)
                break;

            case 22:     // normal colour or normal intensity (neither bold nor faint) (ECMA-48,VT220,VT300)
                dec = TextDecoration.Default;
                break;

            case 23:     // not italicized, not fraktur (ECMA-48)
                break;

            case 24:     // not underlined (neither singly nor doubly) (ECMA-48,VT220,VT300)
                dec = dec.GetCopyWithUnderline(false);
                break;

            case 25:     // steady (not blinking) (ECMA-48,VT220,VT300)
                dec = dec.GetCopyWithBlink(false);
                break;

            case 26:     // reserved (ECMA-48)
                break;

            case 27:     // positive image (ECMA-48,VT220,VT300)
                dec = dec.GetCopyWithInverted(false);
                break;

            case 28:     // revealed characters (ECMA-48)
            case 29:     // not crossed out (ECMA-48)
                break;

            case 30:     // black display (ECMA-48)
            case 31:     // red display (ECMA-48)
            case 32:     // green display (ECMA-48)
            case 33:     // yellow display (ECMA-48)
            case 34:     // blue display (ECMA-48)
            case 35:     // magenta display (ECMA-48)
            case 36:     // cyan display (ECMA-48)
            case 37:     // white display (ECMA-48)
                dec = SelectForeColor(dec, code - 30);
                break;

            case 38:     // reserved (ECMA-48)
                break;

            case 39:     // default display colour (implementation-defined) (ECMA-48)
                dec = dec.GetCopyWithForeColor(ColorSpec.Default);
                break;

            case 40:     // black background (ECMA-48)
            case 41:     // red background (ECMA-48)
            case 42:     // green background (ECMA-48)
            case 43:     // yellow background (ECMA-48)
            case 44:     // blue background (ECMA-48)
            case 45:     // magenta background (ECMA-48)
            case 46:     // cyan background (ECMA-48)
            case 47:     // white background (ECMA-48)
                dec = SelectBackgroundColor(dec, code - 40);
                break;

            case 48:     // reserved (ECMA-48)
                break;

            case 49:     // default background colour (implementation-defined) (ECMA-48)
                dec = dec.GetCopyWithBackColor(ColorSpec.Default);
                break;

            case 50:     // reserved (ECMA-48)
            case 51:     // framed (ECMA-48)
            case 52:     // encircled (ECMA-48)
            case 53:     // overlined (ECMA-48)
            case 54:     // not framed, not encircled (ECMA-48)
            case 55:     // not overlined (ECMA-48)
            case 56:     // reserved (ECMA-48)
            case 57:     // reserved (ECMA-48)
            case 58:     // reserved (ECMA-48)
            case 59:     // reserved (ECMA-48)
            case 60:     // ideogram underline or right side line (ECMA-48)
            case 61:     // ideogram double underline or double line on the right side (ECMA-48)
            case 62:     // ideogram overline or left side line (ECMA-48)
            case 63:     // ideogram double overline or double line on the left side (ECMA-48)
            case 64:     // ideogram stress marking (ECMA-48)
            case 65:     // cancels the effect of the rendition aspects established by parameter values 60 to 64 (ECMA-48)
                break;

            default:
                // other values are ignored without notification to the user
                Debug.WriteLine("unknown SGR code (ANSI) : {0}", code);
                break;
            }
        }