我想创建一个zip文件,其中包含zip文件。我正在使用ICSharpCode.SharpZipLib(由于项目限制,必须使用它)。这工作正常,如果我只有1个字节[]数组..但它不适用于字节[]的列表。创建多字节[]阵列/文件的zip文件
foreach (byte[] internalZipFile in zipFiles)
{
// Source : internal zip file
MemoryStream inputMemoryStream = new MemoryStream(internalZipFile);
ZipEntry newZipEntry = new ZipEntry("AdManifest-" + i.ToString() + ".zip");
newZipEntry.DateTime = DateTime.Now;
zipStream.PutNextEntry(newZipEntry);
StreamUtils.Copy(inputMemoryStream, zipStream, new byte[1024]);
zipStream.CloseEntry();
zipStream.IsStreamOwner = false; // to stop the close and underlying stream
zipStream.Close();
outputMemoryStream.Position = 0;
zipByteArray = outputMemoryStream.ToArray();
i++;
}
using (FileStream fileStream = new FileStream(@"c:\manifest.zip", FileMode.Create))
{
fileStream.Write(zipByteArray, 0, zipByteArray.Length);
}
有人能帮忙吗?我错过了什么?
请仔细阅读[提问]和阐述“不工作”。 – CodeCaster