コード例 #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());
        }
コード例 #2
0
        private static void decode(string orig, string delta)
        {
            var source   = File.ReadAllBytes(orig);
            var target   = File.ReadAllBytes(delta);
            var fileName = Path.ChangeExtension(delta, ".z64");
            var rom      = Xdelta3Lib.Decode(source, target);

            File.WriteAllBytes(fileName, rom.ToArray());
        }
コード例 #3
0
        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);
        }