Ejemplo n.º 1
0
        public static BDiffBlock[] GetBlocks(byte[] source, byte[] destination)
        {
            var a = source.Split((byte)'\n');
            var b = destination.Split((byte)'\n');

            var matches = new SequenceMatcher<Segment>(a, b, (l, r) => l.Equals(r)).GetMatchingBlocks();
        
            return matches.Select(m => new BDiffBlock(m.SourceIndex, m.SourceIndex + m.Length, m.DestinationIndex, m.DestinationIndex + m.Length)).ToArray();
        }