Compare two version of files and apply changes to older file
algorithm, c#, file-comparison
Solution
You're trying to solve the same problem that every MMORPG has solved... creating and applying small patch files to update older versions of large binaries.
This is a well-studied problem and there are a number of solutions out there. For several existing options, see
Binary patch-generation in C#
Problem
I've been searching & googling a lot about this question, and I already know how to compare two files (hashes, checksums, etc.). But it's not quite what I need. What I need is described below. Lets assume I have a file and I've backuped it. Later I've made some changes to this file, so I want to apply changes to the backup version. Since two files can be big enought and changes can be small, I don't want to rewrite all the file, because I'm planning to backup it though the internet (maybe FTP) wich can take a lot of time. How I see this (sample): Backup version of file (bytes) ``` 134 253 637 151 ``` Newer version of file (bytes) ``` 134 624 151 890 ``` Instead of rewriting all bytes, we should: - change `253` to `624` (change bytes) - remove `637` bytes (remove bytes) - write `890` at the end of file (insert bytes) The 1,2,3 options do not necessarily appear at once in each case. Note that the backup file could be located somewhere else, and I only have acces to it through the internet (server could return something so we can compare files). How can I achive this? I know it's possible cause I know software where it's implemented (but couldn't find out how). Any hints, tutorials, etc. is welcomed and highly appriciated. Thanks in advance.