Question

I'm writing an window form similar to 7-Zip, my problem is in the extraction part, I don't know how to check if the archive I want to extract is password protected or not. Any idea?

Was it helpful?

Solution

I've got the solution: just check the extractor before extracting the archive:

if (fileExtractor.Check())
{
   fileExtractor.BeginExtractArchive(destination_dir);
}

Doing it this way the fileExtractor.Check() will be false, if the archive requires a password, and you're not providing the password for it or the password is not correct.

OTHER TIPS

It depends on the archive type. The ZIP specification describes how it's done for ZIP, although it's not very robust apparently.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top