使用Sharpcompress软件包在C#中提取rar文件时,它显示为例外rar标头:16

编程入门 行业动态 更新时间:2024-10-27 04:32:10
本文介绍了使用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

本文发布于:2023-11-06 13:18:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563797.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:软件包   文件   Sharpcompress   rar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!