feat(io): add NestWriter.Write(Stream) overload
Adds a Write(Stream) overload that writes the ZIP archive to any stream with leaveOpen: true so the caller can read back a MemoryStream after the ZipArchive is disposed. Refactors Write(string) to delegate to the new overload. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,12 +28,17 @@ namespace OpenNest.IO
|
||||
}
|
||||
|
||||
public bool Write(string file)
|
||||
{
|
||||
using var fileStream = new FileStream(file, FileMode.Create);
|
||||
return Write(fileStream);
|
||||
}
|
||||
|
||||
public bool Write(Stream stream)
|
||||
{
|
||||
nest.DateLastModified = DateTime.Now;
|
||||
SetDrawingIds();
|
||||
|
||||
using var fileStream = new FileStream(file, FileMode.Create);
|
||||
using var zipArchive = new ZipArchive(fileStream, ZipArchiveMode.Create);
|
||||
using var zipArchive = new ZipArchive(stream, ZipArchiveMode.Create, leaveOpen: true);
|
||||
|
||||
WriteNestJson(zipArchive);
|
||||
WritePrograms(zipArchive);
|
||||
|
||||
Reference in New Issue
Block a user