예제 #1
0
        // == METHODS =====================================================================

        public stringNode AddPath(string value)
        {
            string[] splittedValues = value.Split('/');

            stringNode parentNode = this;
            stringNode node       = null;

            foreach (string splittedValue in splittedValues)
            {
                node = parentNode.Get(splittedValue);
                if (node == null)
                {
                    node = parentNode.AddNode(splittedValue);
                }

                parentNode = node;
            }

            return(node);
        }
예제 #2
0
        public bool RemovePath(string value)
        {
            string[] splittedValues = value.Split('/');

            stringNode parentNode = this;
            stringNode node       = null;

            foreach (string splittedValue in splittedValues)
            {
                node = parentNode.Get(splittedValue);
                if (node != null)
                {
                    parentNode = node;
                }
            }

            if (node != null)
            {
                node.Parent.Nodes.Remove(node);
                return(true);
            }

            return(false);
        }