edwin
New Member
Posts: 2
|
Post by edwin on Feb 23, 2009 23:37:28 GMT -5
Hi, I'm interested in VCLZIP. I am using/have tried other alternatives recently but am having problem with them . Before I try VCLZIP may I ask if the following can be done with it.
1. Is it possible to specify the file date when zipping from a stream? I found the datetime[] property and had completely no idea about how to pass the index parameter. 2. How to rename a file in the ZIP archive?
Thank you.
|
|
|
Post by Kevin on Feb 24, 2009 7:47:32 GMT -5
Hi Edwin,
1. Yes, you can specify the datetime when zipping from a stream within the OnStartZip event. Within that event just call ZipHeader.SetDateTime. You can specify most other things this way too.
2. You can rename a file in an existing archive like this:
VCLZip.Filename[Index] := 'your_new_filename'; VCLZip.SaveModifiedZipFile;
Actually you can change pretty much anything in an existing zip file like in #2, including the DateTime.
Thanks!
Kevin
|
|
edwin
New Member
Posts: 2
|
Post by edwin on Feb 24, 2009 8:39:00 GMT -5
Thank you Kevin.
1. Is it possible to specify the date time when calling ZipFromStream? You know breakdown the code logic in difference places is not a good idea...
2. but my actually question is, how to know the Index? what I know is the file name, but not an integer index value, thank you.
|
|
|
Post by Kevin on Feb 24, 2009 8:57:32 GMT -5
1. No, sorry, there is no way to specify the DateTime from the point of calling ZipFromStream. The structure for the file information has not been created yet at that point.1. Actually, I am close to releasing a new beta version that includes a new feature that allows encrypting and decrypting in place so I took another look at the ZipFromStream code and it was not too hard to add the capability to pass in a TDateTime, so I added it. I will be putting the beta version out today or tomorrow, both as source code for registered users and as a demo for non-registered users. 2. Something like this... function FindFile (Fname: String): Integer; begin for index := 0 to VCLZip.Count-1 do begin if VCLZip.Filename[index] = Fname then break; end; if index = count then result := -1 else result := index; end;
|
|