예제 #1
0
        public static List <LineRange> Insert(this List <LineRange> list, LineRange item)
        {
            int index = list.BinarySearch(item, (a, b) => a.FirstLine.CompareTo(item.FirstLine));

            index = Math.Abs(index);

            return(list);
        }
예제 #2
0
        public static IEnumerable <LineRange> GroupLineRanges(IEnumerable <ContentChangeLine> changes)
        {
            LineRange prev = null;

            foreach (var c in changes)
            {
                var current = c.AsLineRange();

                if (prev == null)
                {
                    prev = current;
                    continue;
                }
            }

            yield break;
        }
예제 #3
0
        public static LineRange AsLineRange(this ContentChangeLine line)
        {
            LineRange result = null;

            if (line.OldLineNo < 0 && line.NewLineNo > 0)
            {
                result        = new LineRange(line.NewLineNo, line.NewLineNo + line.NumLines);
                result.status = DiffStatus.New;
            }
            else if (line.OldLineNo < 0 && line.NewLineNo > 0)
            {
                result        = new LineRange(line.OldLineNo, line.OldLineNo + line.NumLines);
                result.status = DiffStatus.Removed;
            }

            return(result);
        }