Exemplo n.º 1
0
        public new ObjectTreeBuilder GetChild(string childPath)
        {
            if (string.IsNullOrEmpty(childPath))
            {
                return(null);
            }

            if (children == null || children.Count == 0)
            {
                return(null);
            }
            else
            {
                ObjectTreeBuilder superChild = null;
                if (childPath.Contains("/"))
                {
                    string[] splittedPath = childPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    if (!HasChild(splittedPath[0]))
                    {
                        return(null);
                    }
                    else
                    {
                        var child = this[splittedPath[0]];
                        superChild = child.GetChild(string.Join("/", splittedPath.Skip(1)));
                    }
                }
                else
                {
                    superChild = this[childPath];
                }

                return(superChild);
            }
        }
Exemplo n.º 2
0
        public new ObjectTreeBuilder AddChild(string name, List <object> value)
        {
            var node = new ObjectTreeBuilder(name, value)
            {
                Parent = this
            };

            children.Add(node);
            return(node);
        }
Exemplo n.º 3
0
 public ObjectTreeBuilder AddChild(ObjectTreeBuilder child)
 {
     child.Parent = this;
     this.children.Add(child);
     return(this);
 }