我必须在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,m_Bytes.Length); zipStream.CloseEntry(); zipStream.UseZip64 = UseZip64.Off; } }
解决方法
我想到了:
>你可以简单地做一个新的ZipEntry(“Folder1 / Archive.txt”);和新的ZipEntry(“Folder2 / Archive2.txt”);