private static ProjectFileEntry FindProjectFile(SolutionFolder folder, FilePath path) { if (folder is ProjectEntry) { var projectEntry = folder as ProjectEntry; if (projectEntry.HasProject) { var file = projectEntry.Project.GetProjectFile(path.FullPath, false); if (file != null) return file; } } foreach (var subFolder in folder.Nodes) { if (subFolder is SolutionFolder) { var file = FindProjectFile(subFolder as SolutionFolder, path); if (file != null) return file; } } return null; }
private SolutionFolder ReadProjectEntry(Solution parent, Match match) { string path = match.Groups["HintPath"].Value; SolutionFolder entry; Guid typeID = Guid.Parse(match.Groups["TypeGuid"].Value); if (typeID == SolutionFolder.SolutionFolderGuid) { entry = new SolutionFolder(); } else { entry = new ProjectEntry(); } entry.TypeGuid = typeID; entry.Name = match.Groups["Name"].Value; entry.FilePath = new FilePath(parent.FilePath.ParentDirectory.FullPath, match.Groups["HintPath"].Value); entry.ObjectGuid = Guid.Parse(match.Groups["ProjectGuid"].Value); ReadNextLine(); Match sectionMatch; while (IsAtSection(out sectionMatch)) { entry.Sections.Add(ReadSection(sectionMatch)); ReadNextLine(); } if (_currentLine != "EndProject") ThrowSyntaxError("Expected \"EndProject\" keyword."); return entry; }