Exemple #1
0
        public IEnumerable <ExternalLink> ParseRevisionPart(Match remoteMatch, string part, GitRevision revision)
        {
            if (SearchPattern.IsNullOrEmpty() || SearchPatternRegex.Value == null || part == null)
            {
                yield break;
            }

            IList <Match> allMatches = new List <Match>();

            MatchCollection matches = SearchPatternRegex.Value.Matches(part);

            for (var i = 0; i < matches.Count; i++)
            {
                var match = matches[i];
                if (match.Success)
                {
                    if (NestedSearchPattern.IsNullOrEmpty())
                    {
                        allMatches.Add(match);
                    }
                    else if (NestedSearchPatternRegex.Value != null && match.Value != null)
                    {
                        MatchCollection nestedMatches = NestedSearchPatternRegex.Value.Matches(match.Value);

                        for (var n = 0; n < nestedMatches.Count; n++)
                        {
                            allMatches.Add(nestedMatches[n]);
                        }
                    }
                }
            }

            foreach (var match in allMatches.Where(m => m.Success))
            {
                foreach (var format in LinkFormats)
                {
                    yield return(format.ToGitExtLink(remoteMatch, match, revision));
                }
            }
        }