I think I have my method for this....
Here's what I do: (highly condensed code snipit)
Dim lTotalZipSize as Long = 0L
m_zipRoot = New Xceed.Zip.ZipArchive(MyZipFile)
For each Filename in Filenames
File = New DiskFile(Filename)
DestFile = m_zipRoot.GetFile(File.FullName)
File.CopyTo(m_zipEvents, Nothing, DestFile, True)
lTotalZipSize += DestFile.CompressedSize
if lTotalZipSize >= MyThreshold then
'do what I need to do at this point
End if
Next Filename
lTotalZipSize increments by the amount of the last compressed file size and I can test it whenever I need to. The only problem with this approach is that I can't really know I've exceeded MyThreshold until I actually do. With a large file I could exceed it by A LOT! So if I want a zip file to be no larger than 10 megabytes then it's very likely the last file I add could take it WAY over 10 megabytes. Since I have to add it to the archive to get the compressed size I really have no choice. If I absolutely *HAVE* to make sure I don't exceed a certain size then I would need to create a test archive for each one to see how much it compresses. I suppose I could do that, but that would slow down the process so significantly that it just wouldn't be worth it. I suppose I could also look at the filesize and type I'm about to compress and determine a rough ratio before I add it. That would likely bring it pretty close to my goal. This approach seems decent enough - at least for now.
If anyone sees a flaw in my logic please feel free to insult me... :-)
Des
Dan Desjardins
Product Manager
Weather Central, LLC
Madison, WI