public static MatchingResultDto[] ToDto(this IEnumerable <MatchingResult> matchingResults, ISourceCodeRepository sourceCodeRepository) { return(matchingResults .Where(result => result != null) .Select(result => MatchingResultDto.CreateFromMatchingResult(result, sourceCodeRepository)) .ToArray()); }
public static MatchingResultDto CreateFromMatchingResult(MatchingResult matchingResult, ISourceCodeRepository sourceCodeRepository) { var fileNode = matchingResult.Nodes.First().FileNode; var result = new MatchingResultDto( sourceCodeRepository.GetFullPath(fileNode.FileName.Text), fileNode.FileData, matchingResult.TextSpan, matchingResult.Pattern); return(result); }