Exemplo n.º 1
0
        /// <summary>
        /// Add a subnode to this node
        /// </summary>
        /// <param name="inName">Name of the new Node</param>
        /// <returns>The newly created node</returns>
        public stringNode AddNode(string inName)
        {
            stringNode newStrNode = new stringNode(inName);

            Nodes.Add(newStrNode);
            newStrNode.Parent = this;
            return(newStrNode);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add a subnode to this node
        /// </summary>
        /// <param name="inName">Name of the new Node</param>
        /// <param name="inDesc">Description of the new Node</param>
        /// <returns>The newly created node</returns>
        public stringNode AddNode(string inName, string inDesc)
        {
            stringNode newStrNode = new stringNode(inName);

            newStrNode.Description = inDesc;
            Nodes.Add(newStrNode);
            newStrNode.Parent = this;
            return(newStrNode);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add a subnode to this node
        /// </summary>
        /// <param name="inChild">the child to add</param>
        public void AddNode(stringNode inChild)
        {
            if (inChild.Parent != null)
            {
                inChild.Parent.Nodes.Remove(inChild);
            }

            Nodes.Add(inChild);
            inChild.Parent = this;
        }
Exemplo n.º 4
0
        public string GetFullName(bool useRoot)
        {
            string fullName = Name;

            stringNode parent = Parent;

            while (parent != null && (parent.Parent != null || useRoot))
            {
                fullName = parent.Name + "\\" + fullName;
                parent   = parent.Parent;
            }

            return(fullName);
        }
Exemplo n.º 5
0
        public bool IsChildOf(stringNode realDropped)
        {
            foreach (stringNode node in realDropped.Nodes)
            {
                if (this == node)
                {
                    return(true);
                }
                else
                {
                    if (IsChildOf(node))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
        }