【问题标题】:Extracting an ISO to a folder using WinZip/WinRar使用 WinZip/WinRar 将 ISO 提取到文件夹
【发布时间】:2012-05-10 15:25:30
【问题描述】:

我正在尝试使用 C# 提取 ISO,我找到了一个 Winzip 库 DotNetZip,并使用了它,但是当我运行项目时它说它无法提取 ISO。

string activeDir = copyTo = this.folderBD.SelectedPath;;

folderName = toExtract.Remove(toExtract.Length - 4, 4);

Path.Combine(activeDir,  Path.GetFileNameWithoutExtension(folderName));

string zipToUnpack = toExtract;
string unpackDirectory = folderName;

using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
{
    // here, we extract every entry, but we could extract conditionally
    // based on entry name, size, date, checkbox status, etc.  
    foreach (ZipEntry file in zip1)
    {
        file.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
    }
}

这就是我正在使用的代码。 copyTofolderName是从程序中的其他方法传入的。

任何让我在 ISO 上使用 Winzip 或 Winrar 的库都会有很大帮助,但到目前为止,我的搜索没有任何结果。

提前致谢

编辑: 您只能使用带有 C# 的 winrar 提取 .rar 或 .zip,还是可以将要提取的文件作为参数传递以及如何传递?我试过了

ProcessStartInfo startInfo = new ProcessStartInfo("winrar.exe"); Process.Start("winrar.exe",@"C:\file\to\be\extracted");

ISO 位置,但这会返回一个异常,即那里没有可提取的内容。

【问题讨论】:

  • 只要通过提取它以正确的方式创建它,我一直能够提取 ISO。究竟是什么不工作,您确定 ISO 的生成方式正确吗?
  • 我确定 ISO 生成正确。我尝试使用 winzip,因为我为它找到了一个库,所以认为这是唯一的方法,但它不会让我提取 iso,只有一个 zip
  • 你也问了同样的问题Here!和Answer is this!

标签: c# .net iso winrar winzip


【解决方案1】:

您可以使用 Process.Start 从 c# 执行 winrar 并传入提取 iso 所需的参数。

【讨论】:

  • 我不需要导入任何库?
  • @ELSheepO: 不 - 但你必须确保 WinRar 存在于你运行代码的机器上
  • 你有没有机会给我一个关于你使用的粗略代码?我试过 Process.Start(winrar, copyTo, foldername);但正如你可以猜测的那样,它不起作用。我正在使用 system.diagostics 所以我得到了这么多:P
  • 打开了winrar,但要么只是进入c盘,要么没有找到存档
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-12-13
  • 1970-01-01
  • 1970-01-01
  • 2016-10-30
  • 1970-01-01
  • 2010-11-21
  • 1970-01-01
相关资源
最近更新 更多