ICSharpCode.SharpZipLib.Zip解压缩问题求助 我刚用ICSharpCode.SharpZipLib.Zip解压缩文件,压缩文件可以了,可是解压出来的文件是0字节的,不知是什么原因? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 怎么解压的string []FileProperties=new string[2]; FileProperties[0]=strPath; //待解压的文件 FileProperties[1]=strPath+@"\";//解压后放置的目标目录 UnZip(FileProperties); public void UnZip(string[] args) { ZipInputStream s = new ZipInputStream(File.OpenRead(args[0])); 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]+theEntry.Name); 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(); } 就是老是提示length is zero,错误参数seed 如下是原代码public static void UnCompressToFile(string srcFileName, string destFileName) { try { ZipInputStream s = new ZipInputStream(File.OpenRead(srcFileName)); s.Password = "123456"; ZipEntry theEntry = s.GetNextEntry(); FileStream fs = new FileStream(destFileName, FileMode.Create, FileAccess.Write); byte[] data = new byte[s.Length]; while (true) { int size = s.Read(data, 0, data.Length); if (size > 0) { fs.Write(data, 0, size); } else { break; } } s.Close(); } catch (Exception ex) { MessageBox.Show("错误: " + ex.Message); } } 请问需求分析的用户界面和系统架构图是用什么工具画的? TableLayoutPanel如何删除其中某一行 请问关于SelectedIndices 关于C#得到通信端口的问题 C#中数据库的存储实现 今天开始认真很习.问个弱弱的问题 怎样批更新(在线等) 有哪位朋友对背单词软件的词库文件有了解吗?进来聊聊吧? 关于Form打开时的位置问题! 请教下这个乱码文件该如何解析编码? 打开VS2005设计窗体出错 为什么就实现不了密码输错3次 账户不能登录啊?
string []FileProperties=new string[2];
FileProperties[0]=strPath; //待解压的文件
FileProperties[1]=strPath+@"\";//解压后放置的目标目录
UnZip(FileProperties);
public void UnZip(string[] args)
{
ZipInputStream s = new ZipInputStream(File.OpenRead(args[0]));
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]+theEntry.Name);
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();
}
public static void UnCompressToFile(string srcFileName, string destFileName)
{
try
{
ZipInputStream s = new ZipInputStream(File.OpenRead(srcFileName));
s.Password = "123456";
ZipEntry theEntry = s.GetNextEntry(); FileStream fs = new FileStream(destFileName, FileMode.Create, FileAccess.Write);
byte[] data = new byte[s.Length];
while (true)
{
int size = s.Read(data, 0, data.Length); if (size > 0)
{
fs.Write(data, 0, size);
}
else
{
break;
}
} s.Close();
}
catch (Exception ex)
{
MessageBox.Show("错误: " + ex.Message);
}
}