public INode GetFunctionNodeByName(DocumentHierarchy documentHierarchy, string name)
 {
     if (documentHierarchy == null)
     {
         return(null);
     }
     return(documentHierarchy
            .SearchNodesByTerm(name, FullTextFieldType.NameNotAnalyzed)
            .Select(result => result.Node)
            .FirstOrDefault(node => node.NodeType != NodeType.Directory && node.NodeType != NodeType.File && node.NodeType != NodeType.Intermediate));
 }
示例#2
0
 public INode GetFunctionNodeByName(DocumentHierarchy documentHierarchy, string name, string currentFilePath)
 {
     if (documentHierarchy == null)
     {
         return(null);
     }
     return(documentHierarchy
            .SearchNodesByTerm(name, FullTextFieldType.NameNotAnalyzed)
            .Select(result => result.Node)
            .Where(node => node.NodeType != NodeType.Directory && node.NodeType != NodeType.File && node.NodeType != NodeType.Intermediate)
            .OrderBy(node => hasParentWithPath(node, currentFilePath) ? 0 : 1)
            .FirstOrDefault());
 }