Creates a binary patch (in bsdiff format) that can be used (by ) to transform into . The original binary data. The new binary data. A to which the patch wil
(byte[] oldData, byte[] newData, Stream output)
| 48 | /// <param name="newData">The new binary data.</param> |
| 49 | /// <param name="output">A <see cref="Stream"/> to which the patch will be written.</param> |
| 50 | public static void Create(byte[] oldData, byte[] newData, Stream output) |
| 51 | { |
| 52 | // NB: If you diff a file big enough, we blow the stack. This doesn't |
| 53 | // solve it, just buys us more space. The solution is to rewrite Split |
| 54 | // using iteration instead of recursion, but that's Hard(tm). |
| 55 | var ex = default(Exception); |
| 56 | var t = new Thread(() => |
| 57 | { |
| 58 | try |
| 59 | { |
| 60 | CreateInternal(oldData, newData, output); |
| 61 | } |
| 62 | catch (Exception exc) |
| 63 | { |
| 64 | ex = exc; |
| 65 | } |
| 66 | }, 40 * 1048576); |
| 67 | |
| 68 | t.Start(); |
| 69 | t.Join(); |
| 70 | |
| 71 | if (ex != null) throw ex; |
| 72 | } |
| 73 | |
| 74 | static void CreateInternal(byte[] oldData, byte[] newData, Stream output) |
| 75 | { |