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()); }
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()); }
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); }