Вот мой код.
using (FileStream zipToOpen = new FileStream(@"D:\test\1.txt", 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("========================");
}
}
// I reused this stream again and below code just a sample.
// It would get exception
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
{
//System.ArgumentException: 'Update mode requires a stream with read, write, and seek capabilities.'
}
}
Это исключение вызвано тем, что «поток не может быть возобновлен в C#»? Если ответ «да», любые офисные документы могут позволить мне взять ссылку?
Заранее благодарен, если ваши ребята могут оказать некоторую помощь.