/// <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); } if (Status == VCItemStatus.Unknown) { return(UNKNOWN); } 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) { StatusNode found = root.FindPath(path); if (found == null) { foreach (IgnoreEntry ignore in ignores) { if ((ignore.path == "" || path.StartsWith(ignore.path)) && ignore.regex.IsMatch(path)) { found = root.MapPath(path.Substring(ignore.path.Length), VCItemStatus.Ignored); return(found); } } found = new StatusNode(Path.GetFileName(path), VCItemStatus.Unknown); } return(found); }