Exemplo n.º 1
0
        /// <summary>
        /// Returns the first representation of a matching node at level in the code tree.
        /// </summary>
        /// <param name="search_expression"></param>
        /// <returns></returns>
        public NodeList DeepSearch(string search_expression)
        {
            var separser = new SearchExpressionParser(search_expression);
            var parts    = separser.Parse();

            return(this.DeepSearch(parts.ToArray()));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Searches using the given search expressen in each node of the code tree of each C# file.
        /// </summary>
        /// <param name="directory_name">Directory to search in.</param>
        /// <param name="search_expression">The search expression that must be matched from any node.</param>
        /// <param name="include_child_directories"></param>
        /// <param name="approximately_maximum_result"></param>
        /// <returns></returns>
        public static List <NodeList> DeepSearch(string directory_name, string search_expression, bool include_child_directories, int approximately_maximum_result)
        {
            var parser       = new SearchExpressionParser(search_expression);
            var search_nodes = parser.Parse();
            var files        = GetCsFiles(directory_name, include_child_directories, approximately_maximum_result);
            var result       = new List <NodeList>();

            foreach (var file in files)
            {
                var tree = Node.CreateTreeFromFile(file.FullName);
                if (tree.DeepSearch(search_expression).Count > 0)
                {
                    result.Add(tree);
                }
            }
            return(result);
        }