寫入 zip 檔案
要編寫新的 .zip 檔案:
System.IO.Compression
System.IO.Compression.FileSystem
using (FileStream zipToOpen = new FileStream(@"C:\temp", FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
{
ZipArchiveEntry readmeEntry = archive.CreateEntry("Readme.txt");
using (StreamWriter writer = new StreamWriter(readmeEntry.Open()))
{
writer.WriteLine("Information about this package.");
writer.WriteLine("========================");
}
}
}