SevenZipExtractor ISO and UDF Fixes

Jan 11, 2013 at 4:15 PM
Edited Jan 11, 2013 at 4:18 PM

1. Perhaps this is not the best way to determine between udf and iso files but it work for me and I'm sharing it anyway. Rather than putting the test on your application i'd choose to make it on SevenZipExtractor.cs in private void Init(string archiveFullName) method.

so here it is.

this may be starting from line: 83 of private void Init(string archiveFullName) in  SevenZipExtractor.cs and the other instance.

...
 _format = FileChecker.CheckSignature(archiveFullName, out _offset, out isExecutable);
             //    Additional check for ISO file type: the result will be Udf if encoded with UDF format and ISO if Joliet or ISO 9660 encoding
                if (_format == InArchiveFormat.Iso)
                    {
                        {
                            DisposedCheck();
                            SevenZipExtractor ext = new SevenZipExtractor(_fileName, InArchiveFormat.Udf);
                            try
                            {
                                int x = ext.ArchiveFileData.Count;
                                //Reset the file format to UDF
                                ext.Dispose();
                                _format= InArchiveFormat.Udf;
                            }
                            catch (SevenZip.SevenZipArchiveException)
                            {
                             // Nothing happen since it is encode in Joliet or ISO 9660
                            }
                            finally
                            {
                                if (ext._archive != null)
                                {
                                    ext._archive.Close();
                                }
                                ext.Dispose();
                                ext = null;
                            }
                        }
                    }                
            }
            PreserveDirectoryStructure = true;
            SevenZipLibraryManager.LoadLibrary(this, _format);
...

2. Extracting a file from ISO or UDF of large size (around 2Gb or more) and the index of the file is equal to the number of file in it. What will happen is that it will extract all file that you don't need before the file that you really needed. And so again this may not be the best method but I''m sharing it.

Warning!: Never tested with the file types other then ISO and UDF files and extracting more than 1 file. If so happen anyone tested it and it works perfectly probably this will be the fastest way of extraction that SevenZipExtractor can offer.

goto line 1105 when you'd done fix number 1.

Method: public void ExtractFile(int index, Stream stream)

find 

...
 if (_isSolid.Value)
    {
            indexes = SolidIndexes(indexes);
     }
...

remove or quote that lines and that's it.

 

Well, i didn't know much why is it their and in the first place VB.NET if far from C# and i know VB.NET. But I hope you guys enjoyed it.