protected override void OnCommandSent( object sender, CommandSentEventArgs e ) { CommandParser p = new CommandParser(e.Command); string str; if( p.IsIdentifier( out str ) && !e.Canceled && str == CMDSendKey ) { if( str == CMDSendKey ) SendKey( p.StringValue ); } }
static void ParseAll(string s) { CommandParser p = new CommandParser(s); while (p.CurrentToken != CommandParser.Token.EndOfInput) p.GetNextToken(); }
static void CkeckNotIdentifier(string s, int idNotPos) { CommandParser p = new CommandParser(s); while (idNotPos-- > 0) p.GetNextToken(); Debug.Assert(p.CurrentToken != CommandParser.Token.Identifier); }
static void CheckString(string s, int idPos, string strVal) { CommandParser p = new CommandParser(s); while (idPos-- > 0) p.GetNextToken(); Debug.Assert(p.CurrentToken == CommandParser.Token.String && p.StringValue == strVal); }
static void CheckIdentifier(string s, int idPos, string identifier) { CommandParser p = new CommandParser(s); while (idPos-- > 0) p.GetNextToken(); Debug.Assert(p.CurrentToken == CommandParser.Token.Identifier && p.Identifier == identifier); }
protected override void OnCommandSent( object sender, CommandSentEventArgs e ) { string cmd; string m; CommandParser p = new CommandParser( e.Command ); if( !e.Canceled && p.IsIdentifier( out cmd ) && cmd == CMD ) { if( p.Match( CommandParser.Token.OpenPar ) ) if( p.IsString( out m ) ) if( p.Match( CommandParser.Token.ClosePar ) ) if( cmd == CMD ) Exec( m ); } }
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] ); } } } } } } } } }