【发布时间】:2015-08-18 18:41:22
【问题描述】:
我想用 Telerik Wpf Zip 实用程序压缩 MemoryStream。我通过从接受 ms 文件的 Telerik 文档中复制来制作以下方法,该文件的名称为 Zip 存档和密码
private static MemoryStream MakeZipFile(MemoryStream ms, string ZipFileName, string pass)
{
MemoryStream msZip = new MemoryStream();
DefaultEncryptionSettings encryptionSettings = new DefaultEncryptionSettings();
encryptionSettings.Password = pass;
using (ZipArchive archive = new ZipArchive(msZip, ZipArchiveMode.Create, false, null, null, encryptionSettings))
{
using (ZipArchiveEntry entry = archive.CreateEntry(ZipFileName))
{
// Here I don't know how to add my ms to the archive, and return msZip
}
}
任何帮助将不胜感激。
【问题讨论】: