private bool TryGetCellDiff(int row, int column, out ExcelCellDiff cellDiff, bool direct = false) { cellDiff = null; ExcelRowDiff rowDiff; if (TryGetRowDiff(row, out rowDiff, direct)) { return(rowDiff.Cells.TryGetValue(column, out cellDiff)); } return(false); }
private bool IsMatch(ExcelCellDiff cell, string text, bool exactMatch, bool caseSensitive, bool useRegex) { var srcValue = caseSensitive ? cell.SrcCell.Value : cell.SrcCell.Value.ToUpper(); var dstValue = caseSensitive ? cell.DstCell.Value : cell.DstCell.Value.ToUpper(); var target = caseSensitive ? text : text.ToUpper(); if (useRegex) { var regex = new Regex(target); return(regex.IsMatch(srcValue) || regex.IsMatch(srcValue)); } if (exactMatch) { return(target == srcValue || target == dstValue); } return(srcValue.Contains(target) || dstValue.Contains(target)); }
private string GetCellText(ExcelCellDiff cellDiff) { switch (cellDiff.Status) { case ExcelCellStatus.None: return(cellDiff.SrcCell.Value); case ExcelCellStatus.Modified: return(DiffType == DiffType.Source ? cellDiff.SrcCell.Value : cellDiff.DstCell.Value); case ExcelCellStatus.Added: return(DiffType == DiffType.Source ? cellDiff.SrcCell.Value : cellDiff.DstCell.Value); case ExcelCellStatus.Removed: return(DiffType == DiffType.Source ? cellDiff.SrcCell.Value : cellDiff.DstCell.Value); } return(string.Empty); }