Tag: zipoutputstream

如何使用ICSharpCode.SharpZipLib将文件夹添加到zip存档

我必须在zip文件中创建两个文件夹,我使用ICSharpCode.SharZipLib.Zip编程方式创建。 我想要: private void AddToZipStream(byte[] inputStream, ZipOutputStream zipStream, string fileName, string fileExtension) { var courseName = RemoveSpecialCharacters(fileName); var m_Bytes = inputStream; if ((m_Bytes != null) && (zipStream != null)) { var newEntry = new ZipEntry(ZipEntry.CleanName(string.Concat(courseName, fileExtension))); newEntry.DateTime = DateTime.Now; newEntry.Size = m_Bytes.Length; zipStream.PutNextEntry(newEntry); zipStream.Write(m_Bytes, 0, m_Bytes.Length); zipStream.CloseEntry(); zipStream.UseZip64 = UseZip64.Off; } } 如何使用ZipEntry创建目录,然后如何将文件添加到Zip存档内的目录?

使用ZipOutputStream压缩子文件夹

ZipOutputStream仅ZipOutputStream文件夹中的文件。 我也想压缩子文件夹。 我怎样才能做到这一点?