public void Add(TagSegment tagitem, string path = null) { var target = Root; if (path != null) { List <string> tags = new List <string>(path.Split(new string[] { @"/" }, StringSplitOptions.RemoveEmptyEntries)); if (tags[0] == RootTag) { tags.RemoveAt(0); } for (int i = 0; i < tags.Count; i++) { bool check = false; foreach (var item in target.Children) { if (item.Tag == tags[0]) { target = item; check = true; break; } } if (!check) { target = target.AddTag(tags[i]); } } } tagitem.Parent = target; target.Children.Add(tagitem); }
public TagSegment AddTag(string tag) { var newtag = new TagSegment(tag, this); Children.Add(newtag); return(newtag); }
public bool AddTry(string path, TagSegment tagitem) { List <string> tags = new List <string>(path.Split(new string[] { @"/" }, StringSplitOptions.RemoveEmptyEntries)); if (tags[0] == RootTag) { tags.RemoveAt(0); } var target = Root; for (int i = 0; i < tags.Count; i++) { bool check = false; foreach (var item in target.Children) { if (item.Tag == tags[0]) { target = item; check = true; break; } } if (!check) { return(false); } } tagitem.Parent = target; target.Children.Add(tagitem); return(true); }
public void AddValue(string tag, object value) { var list = Find(tag); if (list.Count == 0) { var newtag = new TagSegment(tag, this); newtag.AddValue(value); Children.Add(newtag); } else { list[0].AddValue(value); } }
internal TagSegment(string tag, TagSegment parent) { Tag = tag; Parent = parent; }
public TagFileController(string MasterTag) { Root = new TagSegment(MasterTag, null); }
public TagSegment AddTag(TagSegment tag) { tag.Parent = this; Children.Add(tag); return(tag); }