public Project Parse(string path) { var directory = _pathReader.GetDirectoryName(path); var sourceFiles = new List <SourceFile>(); _xmlReader.Create(path); while (_xmlReader.ReadToFollowing("ClCompile")) { var baseDirectory = directory; var filePath = _xmlReader.GetAttribute("Include"); if (string.IsNullOrWhiteSpace(filePath)) { continue; } filePath = _pathReader.GetFullPath(filePath, baseDirectory); sourceFiles.Add(new SourceFile(filePath) { Repository = _repositoryRegistry.GetRepositoryFromPath(filePath) }); } return(new Project(path, sourceFiles)); }
public Project Parse(string path) { var directory = _pathReader.GetDirectoryName(path); var sourceFiles = new List <SourceFile>(); _xmlReader.Create(path); while (_xmlReader.ReadToFollowing("File")) { var baseDirectory = directory; var filePath = _xmlReader.GetAttribute("RelativePath"); filePath = _pathReader.GetFullPath(filePath, baseDirectory); sourceFiles.Add(new SourceFile(filePath) { Repository = _repositoryRegistry.GetRepositoryFromPath(filePath) }); } return(new Project(path, sourceFiles)); }
public Solution Parse(string path) { var projects = new List <Project>(); var lines = _fileReader.ReadAllLines(path); foreach (var line in lines) { var baseDirectory = _pathReader.GetDirectoryName(path); var match = Regex.Match(line, PROJECT_INCLUDE_REGEX); if (match.Success) { var result = match.Value.Split('"')[5]; while (result.Contains(FOLDER_UP_ONE_LEVEL)) { var index = result.IndexOf(FOLDER_UP_ONE_LEVEL, StringComparison.Ordinal); result = result.Remove(index, FOLDER_UP_ONE_LEVEL.Length); baseDirectory = _directoryReader.GetParent(baseDirectory); } Debug.Assert(baseDirectory != null, nameof(baseDirectory) + " != null"); result = _pathReader.Combine(baseDirectory, result); projects.Add(new Project(result, null)); } } var solution = new Solution(path) { Projects = projects }; return(solution); }