Esempio n. 1
0
        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);
        }
Esempio n. 2
0
            public TagSegment AddTag(string tag)
            {
                var newtag = new TagSegment(tag, this);

                Children.Add(newtag);
                return(newtag);
            }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
            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);
                }
            }
Esempio n. 5
0
 internal TagSegment(string tag, TagSegment parent)
 {
     Tag    = tag;
     Parent = parent;
 }
Esempio n. 6
0
 public TagFileController(string MasterTag)
 {
     Root = new TagSegment(MasterTag, null);
 }
Esempio n. 7
0
 public TagSegment AddTag(TagSegment tag)
 {
     tag.Parent = this;
     Children.Add(tag);
     return(tag);
 }