} // end class ControlSequenceParseState


            public AnsiColorWriter()
            {
                DefaultForeground = ConsoleControl.ForegroundColor;
                DefaultBackground = ConsoleControl.BackgroundColor;

                m_commandTreeRoot = new Dictionary <char, Func <Action <List <int> > > >()
                {
                    { 'm', () => _SelectGraphicsRendition },
                    { '#', _ProcessHashCommand },
                };

                m_hashCommands = new Dictionary <char, Func <Action <List <int> > > >()
                {
                    // TROUBLE: The current definition of XTPUSHSGR and XTPOPSGR use curly
                    // brackets, which turns out to conflict badly with C# string formatting.
                    // For example, this:
                    //
                    //
                    //    $csFmt = (New-ColorString).AppendPushFg( 'Cyan' ).Append( 'this should all be cyan: {0}' )
                    //    [string]::format( $csFmt.ToString( $true ), 'blah' )
                    //
                    // will blow up.
                    //
                    // For now, I'm going to switch to some other characters while we see if
                    // we get can something worked out with xterm.
                    //{ '{', () => _PushSgr },
                    //{ '}', () => _PopSgr },
                    { 'p', () => _PushSgr },
                    { 'q', () => _PopSgr },
                };

                m_state = new ControlSequenceParseState(m_commandTreeRoot);
            } // end constructor
Exemplo n.º 2
0
            } // end class ControlSequenceParseState


            public AnsiColorWriter()
            {
                DefaultForeground = ConsoleControl.ForegroundColor;
                DefaultBackground = ConsoleControl.BackgroundColor;

                m_state = new ControlSequenceParseState(CommandTreeRootStateHandler);
            } // end constructor