/// <summary> /// Recursively find a path in the tree /// </summary> /// <returns>Last node of the path</returns> public StatusNode FindPath(string path) { if (path == ".") { return(this); } int p = path.IndexOf(Path.DirectorySeparatorChar); string childName = p < 0 ? path : path.Substring(0, p); if (HasChildren && Children.ContainsKey(childName)) { StatusNode child = Children[childName]; if (p > 0) { return(child.FindPath(path.Substring(p + 1))); } else { return(child); } } return(null); }
public StatusNode Get(string path) { return(root.FindPath(path)); }