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); }
/// <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); }
/// <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); }