SevenZip/SevenZipExtractor.cs
/// <summary>
///   Unpacks the whole archive to the specified directory.
/// </summary>
/// <param name = "directory">The directory where the files are to be unpacked.</param>
Unpacks the whole archive to the specified directory.
Unpacks the whole archive to the specified directory .
public void ExtractArchive(string directory)
        {
            DisposedCheck();
            ClearExceptions();
            InitArchiveFileData(false);
            try
            {
                IInStream archiveStream;
                using ((archiveStream = GetArchiveStream(true)) as IDisposable)
                {
                    ArchiveOpenCallback openCallback = GetArchiveOpenCallback();
                    if (!OpenArchive(archiveStream, openCallback))
                    {
                        return;
                    }
                    try
                    {
                        using (
                            ArchiveExtractCallback aec = GetArchiveExtractCallback(directory, (int) _filesCount, null))
                        {
                            try
                            {
                                CheckedExecute(
                                    _archive.Extract(null, UInt32.MaxValue, 0, aec),
                                    SevenZipExtractionFailedException.DEFAULT_MESSAGE, aec);
                                OnEvent(ExtractionFinished, EventArgs.Empty, false);
                            }
                            finally
                            {
                                FreeArchiveExtractCallback(aec);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        if (openCallback.ThrowException())
                        {
                            throw;
                        }
                    }
                }
            }
            finally
            {
                if (_archive != null)
                {
                    _archive.Close();
                }
                _archiveStream = null;
                _opened = false;
            }
            ThrowUserException();
        }
public void ExtractArchive ( string directory ) { DisposedCheck ( ) ; ClearExceptions ( ) ; InitArchiveFileData ( false ) ; try { IInStream archiveStream ; using ( ( archiveStream = GetArchiveStream ( true ) ) as IDisposable ) { ArchiveOpenCallback openCallback = GetArchiveOpenCallback ( ) ; if ( ! OpenArchive ( archiveStream , openCallback ) ) { return ; } try { using ( ArchiveExtractCallback aec = GetArchiveExtractCallback ( directory , ( int ) _filesCount , null ) ) { try { CheckedExecute ( _archive . Extract ( null , UInt32 . MaxValue , 0 , aec ) , SevenZipExtractionFailedException . DEFAULT_MESSAGE , aec ) ; OnEvent ( ExtractionFinished , EventArgs . Empty , false ) ; } finally { FreeArchiveExtractCallback ( aec ) ; } } } catch ( Exception ) { if ( openCallback . ThrowException ( ) ) { throw ; } } } } finally { if ( _archive != null ) { _archive . Close ( ) ; } _archiveStream = null ; _opened = false ; } ThrowUserException ( ) ; }
Unpacks the whole archive to the specified directory.
Unpacks the whole archive to the specified directory .
directory
string
The directory where the files are to be unpacked.
The directory where the files are to be unpacked .