This project is read-only.

Couple of issues

Aug 5, 2009 at 12:25 AM
Edited Aug 5, 2009 at 12:29 AM

The first issue that I noticed is that the SevenZipExtractor(string) constructor doesn't release the file handle when it's disposed. For example:

 

            using (var arc = new SevenZip.SevenZipExtractor("C:\\3.zip"))
using (var stream = new MemoryStream())
{
arc.ExtractFile(4, stream);
picPreview.Image = Image.FromStream(stream);
}
File.Delete("C:\\3.zip");

 

Fails to delete the file at the end with the exception "The process cannot access the file 'C:\3.zip' because it is being used by another process."

Whereas,

 

            using (var fstream = File.Open("C:\\3.zip", FileMode.Open))
using (var arc = new SevenZip.SevenZipExtractor(fstream))
using (var stream = new MemoryStream())
{
arc.ExtractFile(4, stream);
picPreview.Image = Image.FromStream(stream);
}
File.Delete("C:\\3.zip");


deletes it correctly.

The second issue is that once I switched to the SevenZipExtractor(stream) constructor, it will no longer open .lzh files. I get a "The stream is invalid." exception.

Any thoughts?


 

Aug 6, 2009 at 6:33 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.