【发布时间】: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);
}
}
这就是我正在使用的代码。 copyTo和folderName是从程序中的其他方法传入的。
任何让我在 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!