SharpZipLib出现异常 快来看看啊!!高手请进……

helloworldysn helloworldysn 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区



using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.BZip2;
using ICSharpCode.SharpZipLib.Checksums;
using ICSharpCode.SharpZipLib.Zip.Compression;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;

/**//// <summary>
/// 解压文件
/// </summary>
/// <param name="args">包含要解压的文件名和要解压到的目录名数组</param>
public void UnZip(string[] args)
{
ZipInputStream s = new ZipInputStream(File.OpenRead(args[0]));
try
{
ZipEntry theEntry;
while ((theEntry = s.GetNextEntry()) != null) //出错位置
{
string directoryName = Path.GetDirectoryName(args[1]);
string fileName = Path.GetFileName(theEntry.Name);

//生成解压目录
Directory.CreateDirectory(directoryName);

if (fileName != String.Empty)
{
//解压文件到指定的目录
FileStream streamWriter = File.Create(args[1]+fileName);

int size = 2048;
byte[] data = new byte[2048];
while (true)
{
size = s.Read(data, 0, data.Length);
if (size > 0)
{
streamWriter.Write(data, 0, size);
}
else
{
break;
}
}

streamWriter.Close();
}
}
s.Close();
}
catch(Exception eu)
{
throw eu;
}
finally
{
s.Close();
}

}



以上代码报有异常:Wrong Local header signature: 0x90014
哪位大侠帮解决一下,困扰死我了!!谢谢咯!!!………………
...全文

相关推荐

ICSharpCode.SharpZipLib.dll 下载 SharpZipLib 解压缩 完整 示例 C#

1.ICSharpCode.SharpZipLib.dll下载 2.源代码 3.解压缩不破坏目录结构

libolei

ICSharpCode.SharpZipLib.dll(版本号0.86.0.518)

ICSharpCode.SharpZipLib(版本号0.86.0.518)的DLL文件

xjzdr

使用SharpZipLib压缩解压缩

使用SharpZipLib压缩解压缩,项目中的SharpZipLib.dll可以在https://download.csdn.net/download/u011392711/10827835下载

大虫FTZ

ICSharpCode.SharpZipLib.dll

using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Win32; using System.IO; using ICSharpCode.SharpZipLib.Checksums; using ICSharpCode.SharpZipLib.Zip; using System.Diagnostics; namespace FileOperations { public class SharpZip { public SharpZip() { } /// /// 压缩 /// /// 压缩后的文件名(包含物理路径) /// 待压缩的文件夹(包含物理路径) public static void PackFiles(string filename, string directory) { try { FastZip fz = new FastZip(); fz.CreateEmptyDirectories = true; fz.CreateZip(filename, directory, true, ""); fz = null; } catch (Exception) { throw; } } /// /// 解压缩 /// /// 待解压文件名(包含物理路径) /// 解压到哪个目录中(包含物理路径) public static bool UnpackFiles(string file, string dir) { try { if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } ZipInputStream s = new ZipInputStream(File.OpenRead(file)); ZipEntry theEntry; while ((theEntry = s.GetNextEntry()) != null) { string directoryName = Path.GetDirectoryName(theEntry.Name); string fileName = Path.GetFileName(theEntry.Name); if (directoryName != String.Empty) { Directory.CreateDirectory(dir + directoryName); } if (fileName != String.Empty) { FileStream streamWriter = File.Create(dir +

jingdian14

SharpZipLib

C#下的zip压缩解压缩工具包

CoolStone1993
评论 3
收藏 已收藏
分享
返回顶部
helloworldysn
C# 111,129 成员 642,539 内容