使用Sharpcompress软件包在C#中提取rar文件时,它显示为例外rar标头:16 [英] When extracting rar file in C# using sharpcompress package, it shows a exceprtion as invalid rar header:16

查看:504
本文介绍了使用Sharpcompress软件包在C#中提取rar文件时,它显示为例外rar标头:16的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

字符串文件名= @" + textBox8.Text;
字符串ppath = @" + System.IO.Path.GetDirectoryName(textBox8.Text)+"\\" System.IO.Path.GetFileNameWithoutExtension(textBox8.Text);
System.IO.Directory.CreateDirectory(@" + ppath);
试试
{
var archive = SharpCompress.Archives.Rar.RarArchive.Open(filename);
foreach(归档文件中的var条目.Entries.Where(entry =>!entry.IsDirectory))
{
entry.WriteToDirectory(ppath,新的ExtractionOptions()
{
});
}
} catch(异常例外)
{
textBox10.Text = Convert.ToString(ex);
}
}

我尝试过的事情:

我使用了Nunrar,SevenZip Extractor和许多软件包,面对同样的错误, 但是在WinRar和7zip中提取的文件

String filename = @"" + textBox8.Text;
string ppath = @"" + System.IO.Path.GetDirectoryName(textBox8.Text) + "\\"System.IO.Path.GetFileNameWithoutExtension(textBox8.Text);
System.IO.Directory.CreateDirectory(@"" + ppath);
try
{
var archive = SharpCompress.Archives.Rar.RarArchive.Open(filename);
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
{
entry.WriteToDirectory(ppath, new ExtractionOptions()
{
});
}
}catch(Exception ex)
{
textBox10.Text = Convert.ToString(ex);
}
}

What I have tried:

I have used a Nunrar,SevenZip Extractor and also many packages,Facing this same error,But that File Extracted in WinRar and 7zip also

推荐答案

当可以使用某些工具(包括官方工具)将归档文件解压缩,而其他工具则不能解压缩时,它可能是由所有解压缩库不支持的选项创建的,或者是RAR 5.0格式并非所有库(尤其是较旧的库)都不支持.

您可以根据文档检查档案的标题:
RAR 5.0存档格式 [ ^ ]

您可能还会向档案库的创建者询问所使用的工具和选项.
When the archive can be unpacked with some tools (including the official one) but not by others, it might have been created with options that are not supported by all uncompressing libraries or it is in RAR 5.0 format which is not supported by all libraries (especially older ones).

You can check the header of the archive against the documentation:
RAR 5.0 archive format[^]

You might also ask the creator of the archive about the used tool and options.


这篇关于使用Sharpcompress软件包在C#中提取rar文件时,它显示为例外rar标头:16的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆