Ejemplo n.º 1
0
 public static MatchingResultDto[] ToDto(this IEnumerable <MatchingResult> matchingResults,
                                         ISourceCodeRepository sourceCodeRepository)
 {
     return(matchingResults
            .Where(result => result != null)
            .Select(result => MatchingResultDto.CreateFromMatchingResult(result, sourceCodeRepository))
            .ToArray());
 }
Ejemplo n.º 2
0
        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);
        }