private bool AreHeadersEqual(string currentHeader) { var unixEndingHeader = currentHeader.Replace("\r\n", "\n"); var unixEndingHeaderFormat = HeaderFormat.Replace("\r\n", "\n"); return(IsRegularExpression ? Regex.IsMatch(unixEndingHeader, unixEndingHeaderFormat) : unixEndingHeader.Equals(unixEndingHeaderFormat, StringComparison.Ordinal)); }
protected bool AreHeadersEqual(string currentHeader) { var unixEndingHeader = currentHeader.Replace("\r\n", "\n"); var unixEndingHeaderFormat = HeaderFormat.Replace("\r\n", "\n").Replace("\\r\\n", "\n"); if (!IsRegularExpression && !unixEndingHeaderFormat.EndsWith("\n")) { // In standard text mode, we want to be sure that the matched header is on its own // line, with nothing else on the same line. unixEndingHeaderFormat += "\n"; } return(IsRegularExpression ? Regex.IsMatch(unixEndingHeader, unixEndingHeaderFormat) : unixEndingHeader.StartsWith(unixEndingHeaderFormat, StringComparison.Ordinal)); }