Beispiel #1
0
        private static void encode(string orig, string changed)
        {
            var source   = File.ReadAllBytes(orig);
            var target   = File.ReadAllBytes(changed);
            var delta    = Xdelta3Lib.Encode(source, target);
            var fileName = Path.ChangeExtension(changed, ".xdelta");

            File.WriteAllBytes(fileName, delta.ToArray());
        }
        public void TestDecodeEncodeRandom(int size)
        {
            var source = CreateRandomArray(size);
            var target = CreateRandomArray(size);

            var delta = Xdelta3Lib.Encode(source: source, target: target);

            delta.Should().NotBeNull();
            delta.Length.Should().BePositive();

            var decoded = Xdelta3Lib.Decode(source: source, delta: delta);

            decoded.Should().NotBeNull();

            decoded.ToArray().Should().BeEquivalentTo(target);
        }