diff options
author | Rob Mensching <rob@firegiant.com> | 2020-02-26 11:30:13 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2020-02-26 11:32:07 -0800 |
commit | ce0fd262e48341402416c8428e37226c80332935 (patch) | |
tree | 0c5b605a8a0fdb965f5f45a5c075c169a588fc1f | |
parent | 4a7b3dd1aea8c0a7b450256d7887052604d30b67 (diff) | |
download | wix-ce0fd262e48341402416c8428e37226c80332935.tar.gz wix-ce0fd262e48341402416c8428e37226c80332935.tar.bz2 wix-ce0fd262e48341402416c8428e37226c80332935.zip |
Hide the ZipArchive details from the public WixOutput API
-rw-r--r-- | src/WixToolset.Data/WixOutput.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/WixToolset.Data/WixOutput.cs b/src/WixToolset.Data/WixOutput.cs index 43a43a6a..bb7a9a70 100644 --- a/src/WixToolset.Data/WixOutput.cs +++ b/src/WixToolset.Data/WixOutput.cs | |||
@@ -13,8 +13,8 @@ namespace WixToolset.Data | |||
13 | /// </summary> | 13 | /// </summary> |
14 | public class WixOutput : IDisposable | 14 | public class WixOutput : IDisposable |
15 | { | 15 | { |
16 | private readonly Stream stream; | ||
16 | private ZipArchive archive; | 17 | private ZipArchive archive; |
17 | private Stream stream; | ||
18 | private bool disposed; | 18 | private bool disposed; |
19 | 19 | ||
20 | private WixOutput(Uri uri, ZipArchive archive, Stream stream) | 20 | private WixOutput(Uri uri, ZipArchive archive, Stream stream) |
@@ -140,10 +140,16 @@ namespace WixToolset.Data | |||
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | public void Reopen(ZipArchiveMode mode) | 143 | /// <summary> |
144 | /// Reopen the underlying archive for read-only or read-write access. | ||
145 | /// </summary> | ||
146 | /// <param name="writable">Indicates whether the output can be modified. Defaults to false.</param> | ||
147 | public void Reopen(bool writable = false) | ||
144 | { | 148 | { |
145 | this.archive?.Dispose(); | 149 | this.archive?.Dispose(); |
146 | this.archive = new ZipArchive(this.stream, mode, leaveOpen: true); | 150 | this.archive = null; |
151 | |||
152 | this.archive = new ZipArchive(this.stream, writable ? ZipArchiveMode.Update : ZipArchiveMode.Read, leaveOpen: true); | ||
147 | } | 153 | } |
148 | 154 | ||
149 | /// <summary> | 155 | /// <summary> |
@@ -178,6 +184,11 @@ namespace WixToolset.Data | |||
178 | return entry.Open(); | 184 | return entry.Open(); |
179 | } | 185 | } |
180 | 186 | ||
187 | /// <summary> | ||
188 | /// Imports a file from disk into the output. | ||
189 | /// </summary> | ||
190 | /// <param name="name">Name of the stream in the output.</param> | ||
191 | /// <param name="path">Path to file on disk to include in the output.</param> | ||
181 | public void ImportDataStream(string name, string path) | 192 | public void ImportDataStream(string name, string path) |
182 | { | 193 | { |
183 | this.archive.CreateEntryFromFile(path, name, System.IO.Compression.CompressionLevel.Optimal); | 194 | this.archive.CreateEntryFromFile(path, name, System.IO.Compression.CompressionLevel.Optimal); |