As I understand it, full 7z.dll seems designed for one single call to UpdateItems for one IOutArchive instance.
If one needs to call UpdateItems more than once, he has to close the archive, open it again and update it via creating a new copy of the existing archive (with appropriate properties to update/delete/add/unchanged items).
My application is long lived (several minutes) and generates a lot of data.
Ideally, I would like to avoid creating a new file each time I add an item.
I would rather add a couple of items, then a couple more, etc... and finally close the archive.
(creating temp files, and putting them in the archive at the end is not an option for me)
Is there a way to achieve this?
Thank you for any hint, question, etc... :-)
If you don't want to write to disk, you can generate stream in RAM. And store that stream to disk after last update.
What do you expect if there is some failure (like power off) during any of these update?
My code handles most of exceptions and software failures conditions.
If those occur, I do expect to "Close" the archive with all the "so far" collected results and terminate nicely.
Any poweroff (or any hardware rooted) conditions are expected to leave a corrupted archive.
...And I do want to write to disk, but inside a unique archive file with compressed data(i.e. no temp files).
.. and Thank you for taking the time answering and considering my question :-)
7-Zip works only in safe mode:
1) create new temp archive
2) rename new temp archive to main name.
There is no unsafe "update old archive" feature in code.
It is very IO/space consuming to create a copy of an archive I'm actually creating.
My need is only to be able to call UpdateItems more than once.
I'm not updating existing items but appending items as data is generated.
Do you think it could be an option to call UpdateItems with a large "numItems" and block calls to GetUpdateItemInfo (or GetProperty) until data is available?
I really cannot store temp data uncompressed on disk or in memory...
In that vein, would it be possible to cancel the unused index?
There is no code in 7-Zip for your requirements.
You can create new archive for each new set of files.
So you will have the bunch of 7z archives.
If you are interested in the functionality, then FCIAddFile is typically what I'd like to achieve with SevenZip (http://msdn.microsoft.com/en-us/library/bb432264(v=VS.85).aspx)