/// <summary> /// The projects in a solution. This does not include solution folders. /// </summary> /// <returns></returns> public async Task <IEnumerable <TfsSolutionProject> > ProjectsAsync() { var solutionDir = Path.GetDirectoryName(ServerPath); var solutionParser = new SolutionFileParser(Download()); return((await solutionParser.GetProjects() .Select(p => Path.Combine(solutionDir, p)) .Select(p => VersionControl.GetItemAsync(p))) .Where(p => p.ItemType == ItemType.File) .Select(p => new TfsSolutionProject(p, VersionControl))); }
/// <summary> /// The files in a project. /// </summary> /// <param name="fileExtensionFilter">Any file extensions to filter out. If empty, all file extensions are returned.</param> /// <returns></returns> public async Task <IEnumerable <TfsFile> > FilesAsync(IReadOnlyCollection <string> fileExtensionFilter) { var projectDir = Path.GetDirectoryName(ServerPath); return((await _projectDocument.Value .Descendants(XName.Get("Compile", ProjectNamespace)).Concat(_projectDocument.Value .Descendants(XName.Get("None", ProjectNamespace))) .Select(e => Path.Combine(projectDir, e.Attribute(XName.Get("Include")).Value)) .Where(p => fileExtensionFilter.Count == 0 || fileExtensionFilter.Contains(Path.GetExtension(p))) .Select(p => VersionControl.GetItemAsync(p))) .Select(i => new TfsFile(i, VersionControl))); }