private static IncludeCandidate FindBestIncludeFilenameCandidates(string sourceFilename, IList <IncludeCandidate> candidates) { switch (candidates.Count) { case 0: return(null); case 1: return(candidates[0]); default: IncludeCandidate bestCandidate = candidates[0]; int bestMatchLength = 0; foreach (IncludeCandidate candidate in candidates) { int matchLength = FindMatchingCharacters(sourceFilename, candidate.Filename); if (matchLength > bestMatchLength) { bestMatchLength = matchLength; bestCandidate = candidate; } } return(bestCandidate); } }
protected override void SelectCandidates(string sourceFilename, IList <IncludeCandidate> candidates) { IncludeCandidate bestCandidate = FindBestIncludeFilenameCandidates(sourceFilename, candidates); if (bestCandidate != null) { bestCandidate.Resolved = true; } }