예제 #1
0
        public VyattaConfigObject AddObject(string Parent)
        {
            string[] Split = Parent.Split(new char[] { ':' }, 2);

            foreach (var ChildNode in Children)
            {
                if (ChildNode.GetAttributeString() == Split[0])
                {
                    if (Split.Length == 2)
                    {
                        return(ChildNode.AddObject(Split[1]));
                    }
                    else
                    {
                        return(ChildNode as VyattaConfigObject);
                    }
                }
            }

            var NewNode = new VyattaConfigObject(new VyattaConfigAttribute(Split[0]));

            Children.Add(NewNode);

            if (Split.Length == 2)
            {
                return(NewNode.AddObject(Split[1]));
            }
            else
            {
                return(NewNode);
            }
        }