惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Know Your Adversary
Know Your Adversary
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
G
Google Developers Blog
有赞技术团队
有赞技术团队
The Register - Security
The Register - Security
T
Tailwind CSS Blog
Blog — PlanetScale
Blog — PlanetScale
L
LangChain Blog
美团技术团队
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
博客园 - Franky
A
About on SuperTechFans
Vercel News
Vercel News
F
Full Disclosure
Recent Announcements
Recent Announcements
博客园 - 叶小钗
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
S
Schneier on Security
Hugging Face - Blog
Hugging Face - Blog
T
The Exploit Database - CXSecurity.com
I
Intezer
月光博客
月光博客
Y
Y Combinator Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CERT Recently Published Vulnerability Notes
S
Securelist
WordPress大学
WordPress大学
小众软件
小众软件
T
Tenable Blog
D
Docker
AWS News Blog
AWS News Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - 司徒正美
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
F
Fortinet All Blogs

博客园 - 朱胜

exeCommand 阻止浏览器事件传递 Ext js Grouping 展开和折叠方法 JS获取上传文件的绝对路径,兼容IE和FF - 朱胜 - 博客园 asp.net2.0中异步调用WebService - 朱胜 - 博客园 ASP.Net的正则表达式(RegularExpression) Extjs简介(二) Extjs框架简介(一) ASP.NET 恢复备份Sql server - 朱胜 WPF学习2:布局(上) WPF学习笔记1 WPF生命周期和参数配置 WPF编程笔记 0:WPF概况(上部分) JavaScript判断文件大小 - 朱胜 - 博客园 clientHeight,offsetHeight和scrollHeight区别 CSS HACK(ie6-ie7-fox 兼容) 页面禁止后退的方法 upLoad控件设置禁止输入的方法 - 朱胜 - 博客园 [ASP.NET] 实现Label自动换行 - 朱胜 - 博客园 js调用web服务范例 - 朱胜 - 博客园
ASP.NET 压缩和解压缩 - 朱胜 - 博客园
朱胜 · 2010-04-25 · via 博客园 - 朱胜


        /// <summary>
        /// 压缩文件
        /// </summary>
        /// <param name="DFilePath">需要压缩的文件夹或者单个文件</param>
        /// <param name="DRARName">生成压缩文件的文件名</param>
        /// <param name="DRARPath">生成压缩文件保存路径</param>
        /// <returns></returns>
        protected bool RAR(string DFilePath, string DRARName, string DRARPath)
        {
            String the_rar;
            RegistryKey the_Reg;
            Object the_Obj;
            String the_Info;
            ProcessStartInfo the_StartInfo;
            Process the_Process;
            try
            {
                the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command");
                the_Obj = the_Reg.GetValue("");
                the_rar = the_Obj.ToString();
                the_Reg.Close();
                the_rar = the_rar.Substring(1, the_rar.Length - 7);
                the_Info = " a    " + " " + DRARName + "  " + DFilePath; //命令 + 压缩后文件名 + 被压缩的文件或者路径
                the_StartInfo = new ProcessStartInfo();
                the_StartInfo.FileName = the_rar;
                the_StartInfo.Arguments = the_Info;
                the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                the_StartInfo.WorkingDirectory = DRARPath; //RaR文件的存放目录。
                the_Process = new Process();
                the_Process.StartInfo = the_StartInfo;
                the_Process.Start();
                return true;
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                return false;
            }
        }

        /// <summary>
        /// 解压缩到指定文件夹
        /// </summary>
        /// <param name="RARFilePath">压缩文件存在的目录 </param>
        /// <param name="RARFileName">压缩文件名称 </param>
        /// <param name="UnRARFilePath">解压到文件夹</param>
        /// <returns></returns>
        protected bool UnRAR(string RARFilePath, string RARFileName, string UnRARFilePath)
        {
            //解压缩
            String the_rar;
            RegistryKey the_Reg;
            Object the_Obj;
            String the_Info;
            ProcessStartInfo the_StartInfo;
            Process the_Process;
            try
            {
                the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");
                the_Obj = the_Reg.GetValue("");
                the_rar = the_Obj.ToString();
                the_Reg.Close();
                the_rar = the_rar.Substring(1, the_rar.Length - 7);
                the_Info = @" X " + " " + RARFilePath + RARFileName + " " + UnRARFilePath;
                the_StartInfo = new ProcessStartInfo();
                the_StartInfo.FileName = the_rar;
                the_StartInfo.Arguments = the_Info;
                the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                the_Process = new Process();
                the_Process.StartInfo = the_StartInfo;
                the_Process.Start();
                return true;
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                return false;
            }
        }