Beispiel #1
0
        public IfBlockExecuter(WaitForTokenHandler waitForTokenHandler, WaitForReTokenHandler waitForReTokenHandler, MatchWaitTokenHandler matchWaitTokenHandler)
        {
            _tokenizer = new Tokenizer(TokenDefinitionRegistry.Default().Definitions());
            _tokenHandlers = new SimpleDictionary<string, ITokenHandler>();

            _tokenHandlers["exit"] = new ExitTokenHandler();
            _tokenHandlers["comment"] = new ContinueTokenHandler();
            _tokenHandlers["debuglevel"] = new DebugLevelTokenHandler();
            _tokenHandlers["var"] = new VarTokenHandler();
            _tokenHandlers["unvar"] = new UnVarTokenHandler();
            _tokenHandlers["hasvar"] = new HasVarTokenHandler();
            _tokenHandlers["goto"] = new GotoTokenHandler();
            _tokenHandlers["waitfor"] = waitForTokenHandler;
            _tokenHandlers["waitforre"] = waitForReTokenHandler;
            _tokenHandlers["pause"] = new PauseTokenHandler();
            _tokenHandlers["put"] = new SendCommandTokenHandler();
            _tokenHandlers["echo"] = new EchoTokenHandler();
            _tokenHandlers["match"] = new MatchTokenHandler();
            _tokenHandlers["matchre"] = new MatchTokenHandler();
            _tokenHandlers["matchwait"] = matchWaitTokenHandler;
            _tokenHandlers["save"] = new SaveTokenHandler();
            _tokenHandlers["move"] = new MoveTokenHandler();
            _tokenHandlers["nextroom"] = new NextroomTokenHandler();
            _tokenHandlers["send"] = new SendTokenHandler();
            _tokenHandlers["parse"] = new ParseTokenHandler();
            _tokenHandlers["containsre"] = new ContainsReTokenHandler();
            _tokenHandlers["gosub"] = new GoSubTokenHandler();
            _tokenHandlers["return"] = new ReturnTokenHandler();
        }
        public void SetUp()
        {
            theGameState = new StubGameState();
            theGameServer = new StubGameServer(theGameState);
            theScriptLog = new InMemoryScriptLog();
            theCommandProcessor = new StubCommandProcessor();

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IScriptLog>(theScriptLog);
            theServices.Add<ICommandProcessor>(theCommandProcessor);

            theLocalVars = new SimpleDictionary<string, string>();

            theScriptContext = new ScriptContext("1", "containsre", CancellationToken.None, theServices, theLocalVars);
            theScriptContext.DebugLevel = 5;
            theHandler = new ContainsReTokenHandler();
        }