示例#1
0
        public static FullNodePathName FromXml(XElement doc)
        {
            var fullPath = new FullNodePathName();

            if (doc != null)
            {
                foreach (var xname in doc.Elements("Name"))
                {
                    fullPath.Names.Add(NodePathName.FromXml(xname));
                }
            }
            return(fullPath);
        }
示例#2
0
        /// <summary>
        /// Gets full node path name of the node's ancestors.
        /// </summary>
        public FullNodePathName CreateFullNodePathName()
        {
            var           fullPath = new FullNodePathName();
            ILSpyTreeNode node     = this;

            while (node.Parent != null)
            {
                fullPath.Names.Add(node.NodePathName);
                node = (ILSpyTreeNode)node.Parent;
            }
            fullPath.Names.Reverse();
            return(fullPath);
        }
示例#3
0
        /// <summary>
        /// Retrieves a node using the NodePathName property of its ancestors.
        /// </summary>
        public ILSpyTreeNode FindNodeByPath(FullNodePathName fullPath)
        {
            ILSpyTreeNode node = this;

            foreach (var name in fullPath.Names)
            {
                if (node == null)
                {
                    break;
                }
                node.EnsureChildrenFiltered();
                node = (ILSpyTreeNode)node.Children.FirstOrDefault(c => ((ILSpyTreeNode)c).NodePathName == name);
            }
            return(node == this ? null : node);
        }