public static bool HasAnyEncryptedFiles(this IArchive archive) {
try {
using (var entry = archive.Entries
.Where(x => x.IsEncrypted && x.Size > 0 && !x.IsDirectory)
.MinEntryOrDefault(x => x.CompressedSize)?
.OpenEntryStream()) {
return entry != null && entry.ReadByte() != -1;
}
} catch (CryptographicException) {
return true;
} catch (Exception e) {
Logging.Write("HasAnyEncryptedFiles(): " + e);
return true;
}
}
}