MatchIsolatedChar() public method

Determine wether a char is the wanted IsolatedChar.
public MatchIsolatedChar ( char c ) : bool
c char The char to test
return bool
Esempio n. 1
0
        protected override void OnCommandSent( object sender, CommandSentEventArgs e )
        {
            string cmd;
            string sub;
            string m;

            CommandParser p = new CommandParser( e.Command );

            if( !e.Canceled && p.IsIdentifier( out cmd ) && cmd == CMDChangeMode )
            {
                if( p.MatchIsolatedChar( '.' ) )
                {
                    p.IsIdentifier( out sub );
                    sub = sub.ToLower();

                    if( p.Match( CommandParser.Token.OpenPar ) )
                        if( p.IsString( out m ) )
                            if( p.Match( CommandParser.Token.ClosePar ) )
                            {
                                if( cmd == CMDChangeMode )
                                {
                                    switch( sub )
                                    {
                                        case "add": Add( m ); return;
                                        case "remove": Remove( m ); return;
                                        case "set": ChangeMode( m ); return;
                                        case "toggle": Toggle( m ); return;
                                    }
                                }
                            }
                }
            }
        }
        protected override void OnCommandSent( object sender, CommandSentEventArgs e )
        {
            if( !e.Canceled )
            {
                CommandParser p = new CommandParser( e.Command );
                if( p.MatchIdentifier( CMD ) )
                {
                    string eventKey;
                    string eventName;

                    if( p.MatchIsolatedChar( '.' ) )
                    {
                        if( p.IsIdentifier( out eventName ) )
                        {
                            if( p.Match( CommandParser.Token.OpenPar ) )
                            {
                                if( p.IsString( out eventKey ) )
                                {
                                    if( p.Match( CommandParser.Token.ClosePar ) )
                                    {
                                        if( p.MatchIsolatedChar( ':' ) )
                                        {
                                            Parse( eventKey, eventName, e.Command.Split( ':' )[1] );
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }