public Node FindNode(string fullPath) { var pathParts = fullPath.GetPathParts(); var branchesQueue = new Queue <string>(pathParts); var path = branchesQueue.Dequeue(); while (!BasePath.Equals(path, StringComparison.CurrentCultureIgnoreCase) && branchesQueue.Count > 0) { path = Path.Combine(path, branchesQueue.Dequeue()); } if (!BasePath.Equals(path, StringComparison.CurrentCultureIgnoreCase)) { return(null); } return(FindNode(Root, branchesQueue, Path.GetFileName(fullPath))); }