private static MatchDetailCollection Merge(MatchCollection collection, string input, MatchDetailCollection details) { if (details == null) { details = new MatchDetailCollection(); } var singles = (from Match item in collection select SelectSingle(item, input)); details.Merge(singles); return(details); }
public static IList <MatchDetail> Select(string input) { if (string.IsNullOrEmpty(input)) { return(null); } var yamlHeader = YamlHeaderRegex.Matches(input); if (yamlHeader.Count == 0) { return(null); } var details = new MatchDetailCollection(); var singles = (from Match item in yamlHeader select SelectSingle(item, input)); details.Merge(singles); return(details.Values.ToList()); }
public static IList <MatchDetail> Select(string input) { if (string.IsNullOrEmpty(input)) { return(null); } var codeSnippet = CodeSnippetRegex.Matches(input); if (codeSnippet.Count == 0) { return(null); } // NOT CORRECT NOW: For code snippet, id is the file path, should be case insensitive // NOTE: For code snippet, it is case sensitive for cross-platform compatability var details = new MatchDetailCollection(StringComparer.Ordinal); var singles = (from Match item in codeSnippet select SelectSingle(item, input)); details.Merge(singles); return(details.Values.ToList()); }