解压缩算法(调用winrar)

这段代码提供了一个名为ZipHelper的C#类,用于调用WinRAR进行文件的压缩和解压缩操作。压缩方法(Zip)接收源文件路径和目标压缩文件名,解压缩方法(UnZip)接收压缩文件路径和目标解压缩目录。方法通过读取注册表获取WinRAR的执行路径,并使用ProcessStartInfo来启动WinRAR进程完成压缩或解压缩任务。
摘要由CSDN通过智能技术生成

/** <summary>
 /// 提供基本的文件压缩与解压缩操作,详细的处理请使用Devlib.Zip
 /// </summary>
 public class ZipHelper
 {
  /// <summary>
  /// 压缩
  /// </summary>
  /// <param name="RarPath">压缩文件目录或压缩文件</param>
  ///<param name="DesFileName">压缩生成文件名</param>
  public static bool Zip(string RarPath,string DesFileName)
  {

   String the_rar;
   RegistryKey the_Reg;
   Object the_Obj;
   String the_Info;
   ProcessStartInfo the_StartInfo;
   Process the_Process;

   
   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);

   string Rarname = DesFileName;

   the_Info = 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值