我必须在以编程方式使用 .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存档内的目录?