private static bool IsQuoteMarksAroundHeaderLines(int startHeaderLinesIndex, int endHeaderLinesIndex, int quoteMarkIndex, IList <QuoteMarkMatchingResult> matchingLines) { bool headerLinesContainsQuoteMarks = RangeHelper.Range(startHeaderLinesIndex, endHeaderLinesIndex).All(i => matchingLines[i].HasQuoteMark); if (headerLinesContainsQuoteMarks) { return(true); } foreach (int i in RangeHelper.Range(endHeaderLinesIndex + 1, quoteMarkIndex)) { if (matchingLines[i].HasQuoteMark) { return(true); } if (matchingLines[i] == QuoteMarkMatchingResult.NotEmpty) { return(false); } } return(true); }
private int GetQuoteBlocksCount(IList <QuoteMarkMatchingResult> matchingLines) { int from = matchingLines.IndexOfFirst(it => it.HasQuoteMark); int to = matchingLines.IndexOfLast(it => it.HasQuoteMark); if (from == -1 || to == -1) { return(0); } int quoteBlocksCount = 0; foreach (int i in RangeHelper.Range(from + 1, to)) { if (matchingLines[i - 1].HasQuoteMark && matchingLines[i].IsTextWithoutQuoteMark) { quoteBlocksCount++; } } return(quoteBlocksCount + 1); }
private static bool IsQuotedTextBetween(int startIndex, int endIndex, IList <QuoteMarkMatchingResult> matchingLines) { return(RangeHelper.Range(startIndex + 1, endIndex - 1).Any(i => matchingLines[i] == QuoteMarkMatchingResult.VNotEmpty)); }