I'm using Librsync in a project to calculate the differences between two versions of a file and apply the changes to the old file.
Outside of my project I got it working in a simple console app that reads the files from 2 different directories, "Patches" them and writes it out to a patched directory.
Code sample -
using (var deltaFile = new FileStream(tmpDeltaFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None))
{
//myClient is the client of a WCF service I created
myClient.ComputeDelta(file.Id, signatureStream).CopyTo(deltaFile);
originalFile.Seek(0, SeekOrigin.Begin);
deltaFile.Seek(0, SeekOrigin.Begin);
var patchedStream = Librsync.ApplyDelta(originalFile, deltaFile);
using (var patchedFileStream = new FileStream(patchedFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None))
{
//Code below just hangs. patchedStream pos = 0 and the length is the same as that of the new file.
patchedStream.CopyTo(patchedFileStream);
}
}