public ActionResult GetFileSource(string projectName, string filePath) { var parsedProjectSourceFiles = SourceParsingManager.ParseProjectSourceFiles( @"C:\Users\Phil\Documents\visual studio 2015\Projects\SourceMaster\SourceMaster.sln", @"SourceMaster"); var projectParsingResults = parsedProjectSourceFiles[projectName]; var adjustedFilePath = filePath.Replace('/', '\\'); var fullFilePath = Path.Combine(projectName, adjustedFilePath); var sourceFile = projectParsingResults?[fullFilePath]; var parentDirectoryPath = Path.GetDirectoryName(fullFilePath) ?? ""; var mappings = projectParsingResults .Where(kvp => kvp.Key.StartsWith(parentDirectoryPath)) .ToDictionary(kvp => kvp.Key.Replace(parentDirectoryPath, string.Empty), kvp => kvp.Value.Path); return(View( new FileSourceViewModel { Content = sourceFile, CurrentDirectoryFileNamesToPaths = mappings } )); }
public void WhenParsingSolution() { SourceParsingManager.ParseProjectSourceFiles( @"C:\Users\Phil\Documents\visual studio 2015\Projects\SourceMaster\SourceMaster.sln", @"SourceMaster"); }