我正在RAR文件中备份我的Steam游戏重点是验证离线L4D2游戏
我希望阅读rar文件中的每个条目然后检查是否存在
但是我收到这个错误
System.IO.InvalidDataException:不支持拆分或跨区存档。位于System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory((
using System;
using System.IO;
using System.IO.Compression;
private void btn_ReadfromZipfile_Click(object sender, EventArgs e)
{
DialogResult result = file.ShowDialog();
if (result == DialogResult.OK)
{
string txtArchiveName = Path.GetFullPath(Path.Combine(Application.StartupPath, file.FileName));
using (ZipArchive zip = ZipFile.OpenRead(txtArchiveName))
{
// Loop through the archive's files.
foreach (ZipArchiveEntry entry in zip.Entries)
{
// if(zip_entry.);
listBox1.SelectedItems.Add(entry.FullName);
CheckFileExists(entry.FullName);
}
}
}
}
Am正在更改为ZIP文件并使用这种离子
using Ionic.Zip;
private void btn_ReadfromZipfile_Click(object sender, EventArgs e)
{
DialogResult result = file.ShowDialog();
if (result == DialogResult.OK)
{
string txtArchiveName = Path.GetFullPath(Path.Combine(Application.StartupPath, file.FileName));
// MessageBox.Show(txtArchiveName);
try
{
using (ZipFile zip = ZipFile.Read(txtArchiveName))
{
// Loop through the archive's files.
foreach (ZipEntry entry in zip)
{
// if(zip_entry.);
listBox1.TopIndex =
listBox1.Items.Add(entry.FileName);
listBox1.SelectedItems.Add(entry.FileName);
// CheckFileExists(entry.FullName);
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error extracting archive.n" + ex.Message);
}
}
}
这很有效。。。刚刚重做了555个游戏感谢您的回答