Example #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);
            theLogger = new InMemoryScriptLog();
            theCancelSource = new CancellationTokenSource();

            theGameState.Set(ComponentKeys.Roundtime, "0");

            theServices = new InMemoryServiceLocator();
            theServices.Add<IGameServer>(theGameServer);
            theServices.Add<IGameState>(theGameState);
            theServices.Add<IScriptLog>(theLogger);

            theScriptContext = new ScriptContext("1", "pausetoken", theCancelSource.Token, theServices, null);

            theHandler = new PauseTokenHandler();
        }