public void AddField(FieldTag field) { if (Model == null) { return; } name = field.getParamAt(1); type = Helper.GetObjType(Model, name, out isNullAble, out newName); if (!fields.Contains(newName)) { Vars.Add(new FromVar(newName, name, type, isNullAble)); fields.Add(newName); } }
/// <summary> /// 测试标签 /// </summary> /// <param name="text">文本(经过格式化)</param> /// <param name="origin">原始文本</param> /// <param name="regex">正则表达式</param> /// <param name="type">目标标签类型</param> private void MatchTag(string text, string origin, Regex regex, TagType type) { if (this.Config.tagregex.TagPairEndTest.IsMatch(text) || this.Config.tagregex.EmptyTest.IsMatch(text) || this.Config.tagregex.ifTagKeyTest.IsMatch(text)) { return; } TheMatch = regex.Match(text); if (TheMatch.Success) { this.Html = this.Html.Replace(origin, text); if (type == TagType._tag_list) { text = FindFirstListTagStr(text, this.TagList.Count()); } if (type == TagType._tag_command) { CMDTag tag = new CMDTag(text, origin, Deep, this.Config, this.TagList.Count); GetCMD(tag); this.TagList.Add(tag); } else if (type == TagType._tag_list) { if (this is SubListPage) { ListTag tag = new ListTag(text, origin, Deep, (this as SubListPage).PageName, this.Config, this.TagList.Count); this.TagList.Add(tag); } else { ListTag tag = new ListTag(text, origin, Deep, this is ItemPage ? (this as ItemPage).PageName : "", this.Config, this.TagList.Count); this.TagList.Add(tag); } } else if (type == TagType._tag_read) { ReadTag tag = new ReadTag(text, origin, Deep, this.Config, this.TagList.Count); this.TagList.Add(tag); } else if (type == TagType._tag_label) { LabelTag tag = new LabelTag(text, origin, Deep, this is LabelPage ? (this as LabelPage).PageName : "", this.Config, this.TagList.Count); tag.LazyLoad(); this.TagList.Add(tag); } else if (type == TagType._tag_static) { StaticTag tag = new StaticTag(text, origin, Deep, this is StaticPage ? (this as StaticPage).PageName : "", this.Config, this.TagList.Count); this.TagList.Add(tag); } else if (type == TagType._tag_filed) { FieldTag tag = new FieldTag(text, origin, Deep, this.Config, this.TagList.Count); this.TagList.Add(tag); } else if (type == TagType._tag_method) { MethodTag tag = new MethodTag(text, origin, Deep, this.Config, this.TagList.Count); this.TagList.Add(tag); } else if (type == TagType._tag_pager) { PagerTag tag = new PagerTag(text, origin, Deep, this.Config, this.TagList.Count); this.TagList.Add(tag); } else if (type == TagType._tag_form) { FormTag tag = new FormTag(text, origin, Deep, this.Config, this.TagList.Count); this.TagList.Add(tag); this.TagCallBack = "form"; } else if (type == TagType._tag_json) { JsonTag tag = new JsonTag(text, origin, Deep, this.Config, this.TagList.Count); this.TagList.Add(tag); this.TagCallBack = "json"; } } }