如何检查rar文件是受密码保护的文件 [英] how to check rar file is password protected file

查看:73
本文介绍了如何检查rar文件是受密码保护的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨亲爱的先生

i有创建zip文件,这是受密码保护的。

以及如何检查这个Rar文件是vb6.0中受密码保护的文件抛出代码;



plz帮助我

hi dear sir
i have create zip file and this is password protected.
and how to check this Rar file is password protected file throw code in vb6.0;

plz help me

推荐答案

您需要做的就是查看文件中的条目。

假设您使用的是SharpZipLib:

All you need to do is look at the entries in the file.
Assuming you are using SharpZipLib:
public static bool IsPasswordProtected(string path)
    {
    using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
        {
        using (ZipInputStream zip = new ZipInputStream(fs))
            {
            ZipEntry entry = zip.GetNextEntry();
            return entry.IsCrypted;
            }
        }
    }



应该这样做。


Should do it.


如果没有使用像 SharpZipLib 这样的第三方[ ^ ]。
This cannot be done without using a third party like SharpZipLib[^].


这篇关于如何检查rar文件是受密码保护的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆