Ejemplo n.º 1
0
        public static LinesRangeDiffResult CreateNew(PerLineDiffResult perLineDiffResult)
        {
            var affectedLines = new List <string> {
                perLineDiffResult.AffectedLine
            };
            var   rangeStart   = new Range(perLineDiffResult.LinePosition, 0);
            var   defaultRange = new Range(0, 0);
            Range sourceRange  = defaultRange;
            Range targetRange  = defaultRange;

            if (perLineDiffResult.IsSourceRecord)
            {
                sourceRange = rangeStart;
            }
            else
            {
                targetRange = rangeStart;
                if (perLineDiffResult.DiffStatus == EDiffStatus.Added)
                {
                    //In case of added, source range starts from one line prior to target start.
                    sourceRange = new Range(targetRange.Start - 1, 0);
                }
            }
            return(new LinesRangeDiffResult
            {
                AffectedLines = affectedLines,
                DiffStatus = perLineDiffResult.DiffStatus,
                SourceRange = sourceRange,
                TargetRange = targetRange
            });
        }
Ejemplo n.º 2
0
 public void Modify(PerLineDiffResult perLineDiffResult)
 {
     Debug.Assert(DiffStatus == perLineDiffResult.DiffStatus, "Modification of Diff status is not allowed.");
     AffectedLines.Add(perLineDiffResult.AffectedLine);
     //With modification, it's going to effect the end range
     if (perLineDiffResult.IsSourceRecord)
     {
         SourceRange = new Range(SourceRange.Start, perLineDiffResult.LinePosition);
     }
     else
     {
         TargetRange = new Range(TargetRange.Start, perLineDiffResult.LinePosition);
     }
 }