CollapseLauncher / SharpHDiffPatch.Core

A port of original HDiffPatch by housisong, written in C# and .NET Standard 2.0 compatible
MIT License
31 stars 6 forks source link

System.ObjectDisposedException: 'Cannot access a closed Stream.' #4

Closed pkr-sadx closed 9 months ago

pkr-sadx commented 9 months ago

Hi! I ran into this exception (PatchDir.cs line 95) while trying to patch a folder with a bunch of files. It works with the C++ version so I thought I should report this.

Files and patch

I used the following code to reproduce it:

 HDiffPatch patcher = new HDiffPatch();
 patcher.Initialize("D:\\diff\\test.dat");
 Directory.CreateDirectory(Path.Combine(AppContext.BaseDirectory, "temp"));
 patcher.Patch("D:\\diff\\in", Path.Combine(AppContext.BaseDirectory, "temp"), false, default, false, true);
neon-nyan commented 9 months ago

Thank you for reporting the issue. will try to investigate this.

neon-nyan commented 9 months ago

Hi there I just pushed a commit that hopefully fix the issue. It was caused by the BZip2 input stream disposing the source FileStream too early when it's reaching EoF. Let me know if it fixes the issue for you.

pkr-sadx commented 9 months ago

Hi! Thank you for the quick response and the fix. The data is now patched without errors.