This project is read-only.

Extract a single file read the archive from start in .iso

Jan 13, 2013 at 10:02 AM

i need to extract only .ifo files from dvd video .iso.
I use 7z64.dll taken from SevenZipShard downloads.

Unfortunaltely, the extraction is slow, i see the first file, then the others are done after a lots of second, and the extraction is finished in more than a minute.
The hd works for all the time, the .iso file is about 6 gb, the .ifo files are about 10-50kb.

If i do the same things with 7zip program gui it takes only a seconds..
There is a way to resolve the problems?

This is my piece of code:

//create extractor
var extr = new SevenZipExtractor(isoPath);
extr.PreserveDirectoryStructure = false;
List<string> ifoFileList = new List<string>();
foreach (string fileArchived in extr.ArchiveFileNames.Where(d => Path.GetExtension(d).ToLowerInvariant() == ".ifo"))
//call extract, this point is very slow and take more than a minute.
extr.ExtractFiles(directory, ifoFileList.ToArray());


Jan 13, 2013 at 1:40 PM

Check this out to fix it.

Jan 19, 2013 at 10:46 AM
Edited Jan 19, 2013 at 10:50 AM

i sniffed the code and found the reason, also reading the discussion about iso and udf.
The archive is treated as a Solid, means that to get a file you need to read all previous indexed files!!

Because if an arhcive DON'T have a property IsSolid, the default is setted = true if is not a .zip archive.

Very very solid approach but devastating for the performance.

This is the piece of code in SevenZipExtractor.cs line 535:

if (!_isSolid.HasValue && _format == InArchiveFormat.Zip)
    _isSolid = false;
if (!_isSolid.HasValue)//why a so devastating approach?? 
    _isSolid = true;
That is my solution:
//call set solid if (!_isSolid.HasValue) _isSolid = IsArchiveSolid(_format);
private bool IsArchiveSolid(InArchiveFormat archiveFormat) { switch (archiveFormat) { case InArchiveFormat.Zip://the only original associated //all other (supposed) standard archive case InArchiveFormat.Iso: case InArchiveFormat.GZip: case InArchiveFormat.SevenZip: case InArchiveFormat.Rar: case InArchiveFormat.Lzw: case InArchiveFormat.Msi: case InArchiveFormat.Arj: return false; default: return true; } }
I don't have any idea of witch format don't support IsSolid = false, but with .iso works very well..
Jan 24, 2013 at 4:00 PM

Yep, agree..

Ok then nice finding.

Im bit confuse when it comes to C#.