Beispiel #1
0
 public void Dispose()
 {
     if (!this._Disposed)
     {
         if (this._Opened)
         {
             try
             {
                 this._Archive.Close();
                 this._Archive                   = (IInArchive)null;
                 this._ArchiveFileData           = (List <ArchiveFileInfo>)null;
                 this._ArchiveProperties         = (ReadOnlyCollection <ArchiveProperty>)null;
                 this._ArchiveFileInfoCollection = (ReadOnlyCollection <ArchiveFileInfo>)null;
                 this._InStream                  = (Stream)null;
             }
             catch (InvalidComObjectException ex)
             {
             }
         }
         if (this._OpenCallback != null)
         {
             try
             {
                 this._OpenCallback.Dispose();
             }
             catch (ObjectDisposedException ex)
             {
             }
             this._OpenCallback = (ArchiveOpenCallback)null;
         }
         if (this._ArchiveStream != null)
         {
             if (this._ArchiveStream is IDisposable)
             {
                 try
                 {
                     if (this._ArchiveStream is DisposeVariableWrapper)
                     {
                         (this._ArchiveStream as DisposeVariableWrapper).DisposeStream = true;
                     }
                     (this._ArchiveStream as IDisposable).Dispose();
                 }
                 catch (ObjectDisposedException ex)
                 {
                 }
                 this._ArchiveStream = (IInStream)null;
             }
         }
         if (!string.IsNullOrEmpty(this._FileName))
         {
             SevenZipLibraryManager.FreeLibrary((object)this, (Enum)this._Format);
         }
     }
     this._Disposed = true;
     GC.SuppressFinalize((object)this);
 }
Beispiel #2
0
 private void Init(string archiveFullName)
 {
     this._FileName = archiveFullName;
     this._Format   = FileChecker.CheckSignature(archiveFullName);
     SevenZipLibraryManager.LoadLibrary((object)this, (Enum)this._Format);
     try
     {
         this._Archive = SevenZipLibraryManager.InArchive(this._Format, (object)this);
     }
     catch (SevenZipLibraryException ex)
     {
         SevenZipLibraryManager.FreeLibrary((object)this, (Enum)this._Format);
         throw;
     }
 }
Beispiel #3
0
 private void Init(Stream stream)
 {
     SevenZipExtractor.ValidateStream(stream);
     this._Format = FileChecker.CheckSignature(stream);
     SevenZipLibraryManager.LoadLibrary((object)this, (Enum)this._Format);
     try
     {
         this._InStream   = stream;
         this._Archive    = SevenZipLibraryManager.InArchive(this._Format, (object)this);
         this._PackedSize = new long?(stream.Length);
     }
     catch (SevenZipLibraryException ex)
     {
         SevenZipLibraryManager.FreeLibrary((object)this, (Enum)this._Format);
         throw;
     }
 }
Beispiel #4
0
 public static void SetLibraryPath(string libraryPath)
 {
     SevenZipLibraryManager.SetLibraryPath(libraryPath);
 }
Beispiel #5
0
 public void SetNonExistant7zDllLocationTest()
 {
     Assert.Throws <SevenZipLibraryException>(() => SevenZipLibraryManager.SetLibraryPath("null"));
 }