Question Test if it´s an valid archive

muffivb

New member
Joined
Sep 1, 2011
Messages
1
Programming Experience
3-5
I´m using SevenZipSharp (with 7z.dll). Now I´m trying to write a little program that will test the files of a directory if there is a file which could be extracted by 7z.dll.

First try was like this:
Code:
Dim file As SevenZipExtractor = New SevenZipExtractor(IO.File.OpenRead(path))
At the first non-valid archive file, this line throws me a "The stream is invalid or no corresponding signature was found.". Of course I can use Try...End Try, but this seems to be slow. Is there any better solution to test if the file is valid for 7z.dll?

Thanks!
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,411
Location
Norway
Programming Experience
10+
There doesn't appear to be any preliminary detection available. File extension should be primary identification for valid file types.
 
Top Bottom