/// <summary> /// Recursively evaluates the template nodes returned from the bot /// </summary> /// <param name="node">the node to evaluate</param> /// <param name="request">the request from the user</param> /// <param name="result">the result to be sent to the user</param> /// <param name="user">the user who originated the request</param> /// <returns>the output string</returns> private string ProcessNode(XmlNode node, Request request, Result result, User user) { StringBuilder newInnerText = new StringBuilder(); if (node.HasChildNodes) { // recursively check foreach (XmlNode childNode in node.ChildNodes) { childNode.InnerText = this.ProcessNode(childNode, request, result, user); } } // process the node itself AIMLTagHandler tagHandler = null; switch (node.Name.ToLower()) { case "bot": tagHandler = new BotTag(this, user, request, result, node); break; case "condition": tagHandler = new ConditionTag(this, user, request, result, node); break; case "date": tagHandler = new DateTag(this, user, request, result, node); break; case "formal": tagHandler = new FormalTag(this, user, request, result, node); break; case "gender": tagHandler = new GenderTag(this, user, request, result, node); break; case "get": tagHandler = new GetTag(this, user, request, result, node); break; case "gossip": tagHandler = new GossipTag(this, user, request, result, node); break; case "id": tagHandler = new IdTag(this, user, request, result, node); break; case "input": tagHandler = new InputTag(this, user, request, result, node); break; case "javascript": tagHandler = new JavascriptTag(this, user, request, result, node); break; case "learn": tagHandler = new LearnTag(this, user, request, result, node); break; case "lowercase": tagHandler = new LowercaseTag(this, user, request, result, node); break; case "person": tagHandler = new PersonTag(this, user, request, result, node); break; case "person2": tagHandler = new Person2Tag(this, user, request, result, node); break; case "random": tagHandler = new RandomTag(this, user, request, result, node); break; case "sentence": tagHandler = new SentenceTag(this, user, request, result, node); break; case "set": tagHandler = new SetTag(this, user, request, result, node); break; case "size": tagHandler = new SizeTag(this, user, request, result, node); break; case "sr": tagHandler = new SrTag(this, user, request, result, node); break; case "srai": tagHandler = new SraiTag(this, user, request, result, node); break; case "star": tagHandler = new StarTag(this, user, request, result, node); break; case "system": tagHandler = new SystemTag(this, user, request, result, node); break; case "that": tagHandler = new ThatTag(this, user, request, result, node); break; case "thatstar": tagHandler = new ThatStarTag(this, user, request, result, node); break; case "think": tagHandler = new ThinkTag(this, user, request, result, node); break; case "topicstar": tagHandler = new TopicStarTag(this, user, request, result, node); break; case "uppercase": tagHandler = new UppercaseTag(this, user, request, result, node); break; case "version": tagHandler = new VersionTag(this, user, request, result, node); break; default: tagHandler = this.GetBespokeTags(user, request, result, node); break; } if (object.Equals(null, tagHandler)) { return(node.InnerText); } else { return(tagHandler.Transform()); } }
public IActionResult GetTag(Guid tagId) { var result = new GetTag(dbContext).Run(tagId); return(Ok(new GetTagViewModel(result))); }