There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
expose CountingStream as a public type
The developer is experiencing problem with a self extracting archive that uses a custom SFX stub, saved directly to Response.OutputStream.
Here's the thing. Suppose you open a filesystem file (getting a FileStream), save
a custom sfx stub into it, and then call ZipFile.Save() into that FileStream. ZipFile.Save() does the right thing for the zipentry offsets, by inquiring the Position of the FileStream before writing any data, and then adding that initial offset into
any ZipEntry offsets in the zip directory.
This does not work for HttpResponse.OutputStream, because it is not possible to inquire the Position on that stream. Position is not defined for that stream type. Therefore the writes that happen within the context of ZipFile.Save() cannot do
the fixup arithmetic.
The workaround is for the application to wrap HttpResponse.OutputStream in a wrapper stream that supports the Position property; then write the SFX stub and the ZipFile into that wrapper stream. Because ZipFile.Save() can inquire the Position, it will then
do the right thing with the offsets. In the source for DotNetZip, there is a wrapper stream class called CountingStream that does exactly what you want; unfortunately it is limited to internal use.
This workitem is a request to expose that class publicly, and document it.