ExtractFileCallback not called for .7z files

Apr 6, 2010 at 5:05 PM

Hello,

i need to extract into memory some files from compressed archives and i've implemented a little procedure extracting the single files with ExtractFile of SevenZipExtractor. This function works right with all the formats i use (ZIP, RAR, 7z) but of course the last format is slow because for each file it seek the entire archive. So i've used ExtractFiles with the Callback function but this works all right only with Zip and Rar files, with 7z it reads correctly the files inside the archive but the callback function is never called. I've tried to create a .7z file by myself, compiling in 32 or 64 bit mode (in 32 bit i use your custom dll, in 64 the dll installed by the 7z installer in Windows).

Any idea if i've to set any property before calling ExtractFiles?

the code is this

// the extractor
extractor = new SevenZip.SevenZipExtractor(archiveFilename);

// the buffer inside the loader class declared as property
ms = new MemoryStream();
bs = new BufferedStream(ms);
           
// the callback function is a function inside the loader class
extractor.ExtractFiles(extractCallback);

the callback is create as

extractCallback = new SevenZip.ExtractFileCallback(this.ExtractFileCallback);


private void ExtractFileCallback(SevenZip.ExtractFileCallbackArgs args)
{
...
}

Thanks

Coordinator
Apr 12, 2010 at 5:31 PM

As I remember, ExtractFileCallback was not implemented for 7zip archives because of the difficulties of solid mode or something. Alas!

Apr 13, 2010 at 7:09 PM

Is something that will be implemented ? :) I'm creating an image viewer of pictures archived in compressed files and i need to copy the extracted data into memory and not files (the viewer needs to help see the images without having to extract them). I've completed everything for zip and rar files and it's very fast but i'd like to support also 7z files. If there's no plan to implement the function maybe i can take a look at the sources and do something...

Coordinator
Apr 15, 2010 at 4:49 AM

As a last resort you may try ExtractFile(string, Stream) overload to extract a particular file to stream. This function is slightly slower than ExtractFiles, but not much really. I will implement the feature you ask one day, but it will take a lot of time.

Jul 7, 2010 at 2:02 PM
Hi Markhor I happen to be doing similar stuff like elvencode. I am trying to do some image conversion in-memory during the extraction process. The only way to do it is to use the ExtractFile (stream) function. However for my 40mb sample 7z file which contains 1000 BMPs, this will take hours. The same thing in 7Zip will only take a minute. I understand that this is due to the solid archive requiring to scan through the whole file. So I am also very intereted in the ExtractFiles being able to support solid archive too. Just wondering if there are other ways I can try to do this (like modifying your source code so just before the file is written to the disk I am able to convert it)? Thanks so much.