Ejemplo n.º 1
0
            public void BuildHierarchy(Node node)
            {
                if (node.IsRealFile)
                {
                    try
                    {
                        using (StreamReader r = new StreamReader(node.FilePath))
                        {
                            for (int lineNum = 1; !r.EndOfStream; lineNum++)
                            {
                                string line = r.ReadLine();

                                Match match = _searchPattern.Match(line);
                                if (match != null && match.Groups.Count > 1)
                                {
                                    // Resolve the path
                                    string resolvedPath;
                                    _searchPaths.Resolve(match.Groups[1].Value, out resolvedPath);
                                    Node child = GetNodeForPath(resolvedPath);
                                    node.AddChild(child, lineNum);
                                }
                            }
                        }
                    }
                    catch (FileNotFoundException)
                    {
                    }
                }
            }