In My application I am using DotNetZip to Zip & UnZip files. Before Extracting files I want to know if password provided is correct or not. Right now I am doing it like this.
foreach (var sourceFile in sourceFileNames) {
ZipFile file = ZipFile.Read(sourceFile);
foreach (ZipEntry entry in file.Entries) {
if (FileSystem.Exists(conf.Target + entry.FileName)) {
FileSystem.Delete(conf.Target + entry.FileName);
}
if (!string.IsNullOrEmpty(conf.Password)) {
entry.Password = conf.Password;
}
entry.Extract(conf.Target);
}
}
Here 'sourceFileNames' contains list of zip files
If password is wrong or not provided then then It will give error but I do not want to do Like this.
What I want to do is first check passwords for each zip file & if all zip file has correct password then only extract them all.