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); theGameStream = new GameStream(theGameState); theGameState.Set(ComponentKeys.Roundtime, "0"); theLog = new InMemoryScriptLog(); theServices = new InMemoryServiceLocator(); theServices.Add<IGameServer>(theGameServer); theServices.Add<IScriptLog>(theLog); theScriptContext = new ScriptContext("1", "waitfor", CancellationToken.None, theServices, null); theScriptContext.DebugLevel = 5; theHandler = new WaitForTokenHandler(theGameState, theGameStream); }
public void SetUp() { theLog = new InMemoryScriptLog(); theGameState = new StubGameState(); theGameServer = new StubGameServer(theGameState); theGameStream = new GameStream(theGameState); theServices = new InMemoryServiceLocator(); theServices.Add<IGameServer>(theGameServer); theServices.Add<IGameState>(theGameState); theServices.Add<IScriptLog>(theLog); theServices.Add<IVariableReplacer>(new VariableReplacer()); theServices.Add<ICommandProcessor>(new CommandProcessor(theServices, theServices.Get<IVariableReplacer>(), theLog)); theServices.Add<IIfBlocksParser>(new IfBlocksParser()); var waitFor = new WaitForTokenHandler(theGameState, theGameStream); var waitForRe = new WaitForReTokenHandler(theGameState, theGameStream); var matchWait = new MatchWaitTokenHandler(theGameState, theGameStream); theServices.Add<WaitForTokenHandler>(waitFor); theServices.Add<WaitForReTokenHandler>(waitForRe); theServices.Add<MatchWaitTokenHandler>(matchWait); theServices.Add<IIfBlockExecuter>(new IfBlockExecuter(waitFor, waitForRe, matchWait)); theServices.Add<IGameStream>(theGameStream); theScript = new Script(theServices, Tokenizer.With(TokenDefinitionRegistry.Default())); }
public void SetUp() { theScript = new StubScript(); theLoader = new StubScriptLoader(); theLogger = new InMemoryScriptLog(); theGameState = new StubGameState(); theGameServer = new StubGameServer(theGameState); theReplacer = new VariableReplacer(); theServices = new InMemoryServiceLocator(); theGameStream = new GameStream(theGameState); var waitForTokenHandler = new WaitForTokenHandler(theGameState, theGameStream); var waitForReTokenHandler = new WaitForReTokenHandler(theGameState, theGameStream); var matchWaitTokenHandler = new MatchWaitTokenHandler(theGameState, theGameStream); theServices.Add<IGameServer>(theGameServer); theServices.Add<IGameState>(theGameState); theServices.Add<IScriptLog>(theLogger); theServices.Add<ICommandProcessor>(new CommandProcessor(theServices, theReplacer, theLogger)); theServices.Add<IVariableReplacer>(theReplacer); theServices.Add<IIfBlocksParser>(new IfBlocksParser()); theServices.Add<WaitForTokenHandler>(waitForTokenHandler); theServices.Add<WaitForReTokenHandler>(waitForReTokenHandler); theServices.Add<MatchWaitTokenHandler>(matchWaitTokenHandler); theServices.Add<IIfBlockExecuter>(new IfBlockExecuter(waitForTokenHandler, waitForReTokenHandler, matchWaitTokenHandler)); theRunner = new ScriptRunner(theServices, theLoader, theLogger); theRunner.Create = () => theScript; }