-
Notifications
You must be signed in to change notification settings - Fork 509
Closed
Labels
Description
Issue: #960 (comment)
Sometimes you don't know if the file is a RAR or 7Zip that may have SOLID entries. The current interface requires you to know in advance about SOLID or not.
Provide an interface that doesn't require to know in advance.
ExtractAllEntries doesn't feel right to be used alongside Entry enumeration.
This is what used to work:
public void ExtractToDirectory( string archivePath, string extractPath )
{
// Lock for Extraction Progress because of Singleton
lock( extractToDictionarySyncObject )
{
var options = new ExtractionOptions() {
ExtractFullPath = true,
Overwrite = true
};
Directory.CreateDirectory( extractPath );
using IArchive archive = ArchiveFactory.Open( archivePath );
double totalSize = archive.Entries.Where( e => !e.IsDirectory ).Sum( e => e.Size );
long completed = 0;
IReader reader = archive.ExtractAllEntries();
while( reader.MoveToNextEntry() )
{
if( !reader.Entry.IsDirectory )
{
reader.WriteEntryToDirectory( extractPath, options );
completed += reader.Entry.Size;
ExtractionProgress?.Invoke( this, new ExtractionProgressEventArgs( completed / totalSize ) );
}
}
}
}
Reactions are currently unavailable