mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-06 20:25:44 -05:00
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:
1 parent
d7cc08dff7
commit
e324e15fc0
1 file changed
+7
-2
@@ -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