Esempio n. 1
0
        private void UpdateBuilder()
        {
            for (int i = 0; i < _preSkip; i++)
            {
                //FireLineUpdate(DiffType.None, _left[i]);
                _resultReportBuilder.Append(EDiffStatus.None, i, _sourceLines[i], true);
            }

            if (_preSkip >= _sourceLines.Length)
            {
                //We consumed all of source lines, all lines of target are to be added
                for (int rowIndex = _preSkip; rowIndex < _targetLines.Length; rowIndex++)
                {
                    _resultReportBuilder.Append(EDiffStatus.Added, rowIndex + 1, _targetLines[rowIndex], false);
                }
            }

            if (_postSkip >= _sourceLines.Length)
            {
                //We consumed all of source lines, all lines of target are to be added
                for (int rowIndex = 0; rowIndex < _targetLines.Length - _postSkip; rowIndex++)
                {
                    _resultReportBuilder.Append(EDiffStatus.Added, rowIndex + 1, _targetLines[rowIndex], false);
                }
            }

            int totalSkip = _preSkip + _postSkip;

            if (!(_totalSkip >= _sourceLines.Length || _totalSkip >= _targetLines.Length))
            {
                //Im this scenario only matrix is created
                AppendLcsDiff(_sourceLines.Length - totalSkip, _targetLines.Length - totalSkip);
            }

            int leftLen = _sourceLines.Length;

            for (int i = _postSkip; i > 0; i--)
            {
                _resultReportBuilder.Append(EDiffStatus.None, leftLen, _sourceLines[leftLen - i], true);
            }
        }