public static InArchiveFormat CheckSignature(string fileName)
 {
     using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
     {
         try
         {
             return(FileChecker.CheckSignature((Stream)fileStream));
         }
         catch (ArgumentException ex)
         {
             return(Formats.FormatByFileName(fileName, true));
         }
     }
 }
Пример #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;
     }
 }
Пример #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;
     }
 }