示例#1
0
 public DiffBlock(int offset, int startPosition, int endPosition, DiffBlockType type)
 {
     this.Offset        = offset;
     this.StartPosition = startPosition;
     this.EndPosition   = endPosition;
     this.Type          = type;
 }
示例#2
0
        public static void AppendDiffBlock(this DiffFile diffFile, int blockPosition, int offset,
                                           DiffBlockType type)
        {
            var diffBlock = diffFile.Blocks.LastOrDefault();

            if (diffBlock != null && diffBlock.Type == type &&
                diffBlock.EndPosition + 1 == blockPosition)
            {
                diffBlock.EndPosition++;
                return;
            }

            diffBlock = new DiffBlock(offset, blockPosition, blockPosition, type);
            diffFile.Blocks.Add(diffBlock);
        }
        private static ClassificationType ConvertDiffBlockTypeToClassificationType(DiffBlockType diffBlockType)
        {
            switch (diffBlockType)
            {
            case DiffBlockType.Deleted:
                return(ClassificationType.DeletedLine);

            case DiffBlockType.Imaginary:
                return(ClassificationType.ImaginaryLine);

            case DiffBlockType.Inserted:
                return(ClassificationType.InsertedLine);

            case DiffBlockType.Modified:
                return(ClassificationType.ModifiedLine);
            }

            throw new ArgumentException("Invalid diff type");
        }
示例#4
0
 public static void AddDiffBlock(this DiffFile file, DiffInfo textInfo, DiffBlockType diffBlockType)
 {
     file.AppendDiffBlock(textInfo.BlockPosition, textInfo.TextOffset,
                          diffBlockType);
     textInfo.BlockPosition++;
 }
示例#5
0
        private static void AddBlockWithImagineryPart(DiffInfo imagineryTextInfo, DiffFile imagineryBlockFile,
                                                      DiffInfo textInfo, DiffFile file, DiffBlockType nonImagineryBlockType)
        {
            imagineryBlockFile.AddImaginaryBlock(imagineryTextInfo);

            file.AddDiffBlock(textInfo, nonImagineryBlockType);
        }