|
Post by Petko on Mar 9, 2005 16:25:03 GMT -5
Kevin, I am using VCLZip Pro in an application, which works with relatively files and I have just found that I am not using VCLZip Pro properly, and that is why my apllication saves very slow.
My application freqently changes only several files in the archive, however, because I use ZipFromStream, without using the GetNextStream event, when the file is large, it saves it quite slow.
I will change this, however I have an additional question: when my application saves its files, occasionaly it also deletes files from the archive. What is the most efficent way to delete several files, change other files and add other files, using VCLZip Pro?
The fastest way, which I currently could think of is: Delete the files using DeleteEnries, then using ZipFromStream for the first changed file and GetNextStream for the other files. However this (as far as I understant), will recreate the zip file twice. Is is possible to recreate it only once?
|
|
|
Post by Kevin on Mar 9, 2005 18:21:57 GMT -5
Petko,
Unfortunately, I think you are probably doing things the best way possible. I have not added a process yet that allows deletes and zips in the same pass.
Kevin
|
|
|
Post by Petko Georgiev on Mar 10, 2005 7:33:36 GMT -5
Kevin, I am having difficulties using the OnGetNextStream event. It is not fired in my project.
Here is how I try to use it: I hava a TVCLZip component named RecordsCompressor on my main form. I have an OnGetNextStream event defined for this component.
The I use the following code: =============================== bool SaveRecordsToArchive(AnsiString archiveName, TSaveRecordsInfo* recordsInfo) { Main->RecordsCompressor->PackLevel = 3; Main->RecordsCompressor->DoProcessMessages = false; //if this is set to true, the problem persists Main->RecordsCompressor->ZipName = archiveName; Main->RecordsCompressor->Tag = (int)recordsInfo; //if this is set to 0, the problem persists
TSaveRecord* firstRecord = recordsInfo->GetFirstRecord(); Main->RecordsCompressor->Password = firstRecord->TargetFilePassword; Main->RecordsCompressor->ZipFromStream(firstRecord->Stream, firstRecord->TargetFileName); Main->RecordsCompressor->ZipName = "";
return true; } ===============================
As I understand, the OnGetNextStream event should be fired immediatelly after calling the ZipFromStream method, however this is not the case in my project. This event is never called.
What I am doing wrong here?
|
|
|
Post by Petko Georgiev on Mar 12, 2005 9:20:18 GMT -5
Kevin, any update on this one?
I have found that OnGetNextStream is not fired, if the ZipFromStream added file to the archive, which already existed there. In other words, if ZipFromStream overwrites a file, the OnGetNextStream is not fired.
|
|
|
Post by Kevin on Mar 12, 2005 9:31:57 GMT -5
Petko,
Sorry, I just now read your post for the first time. That event was meant for creating new archives, not modifying existing ones, but I'll look into that today and see if it can easily be modified to handle that.
Kevin
|
|
|
Post by Petko Georgiev on Mar 12, 2005 10:06:53 GMT -5
Thank you Kevin! Meanwhile I will search for a workaround, because I need it today or tomorrow at latest.
Maybe, if I delete the files I am going to overwrite first, it will work OK.
|
|
|
Post by Kevin on Mar 12, 2005 10:21:26 GMT -5
That would more than likely work.
Looking at the code, the problem with using OnGetNextStream when updating an archive is that there are no dates associated with a stream like there is with a file (used to determine if file should be replaced - unless using zaReplace), and there is the problem of knowing what stream to use to replace the file. Modifying a file works strictly from the FilesList.
Kevin
|
|
|
Post by Petko Georgiev on Mar 12, 2005 12:17:36 GMT -5
Kevin, it works this way. If I delete the files, I am going to overwrite, the OnGetNextStream is fired.
|
|
|
Post by Kevin on Mar 12, 2005 15:44:33 GMT -5
Very good!! ;D
kevin
|
|