Recent

Author Topic: Zipper unit questions  (Read 4565 times)

Milsa

  • Sr. Member
  • ****
  • Posts: 328
Zipper unit questions
« on: September 15, 2015, 12:51:28 pm »
I am using Zipper unit. I have any questions:
1. It is possible to set methods for show progress (application "does not working" but compress is in background - 500 MB archive).
2. It is in thread. Is it possible to abort TZipper.ZipAllFiles (end of application, etc.)?
3. Is better compress unit as this?
I work with Lazarus 4.0, FPC 3.2.2, date 2025-05-03
This information is actual to: 3rd Aug 2025

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12768
  • FPC developer.
Re: Zipper unit questions
« Reply #1 on: September 15, 2015, 02:09:48 pm »
1. you need to set the onprogress then to methods of your zipping thread, and those methods must carry the event to the mainthread using synchronize or queue()  (queue is fpc 3.0+).

2. no. But maybe you can copy the zipall/savetofile/savetostream code in your own code and modify it to check for termination. It should be reasonably doable to implement termination between files. But that is of course no help if you have a few large files to compress.

Aborting also inside files (between blocks to compress) requires some reworking of zipper unit I guess. Not impossible, but more involved.

3. Not that I know. The only other one is (TP-)Abbrevia.

Milsa

  • Sr. Member
  • ****
  • Posts: 328
Re: Zipper unit questions
« Reply #2 on: September 16, 2015, 08:58:08 pm »
How can I insert entry to Zipper if I want UTF-8 characters in filenames readable in Total Commander?
Tipper.Entries.AddFileEntry(src, dst);
How can I change dst parameter?
I have slovak characters in filenames.
I work with Lazarus 4.0, FPC 3.2.2, date 2025-05-03
This information is actual to: 3rd Aug 2025

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12768
  • FPC developer.
Re: Zipper unit questions
« Reply #3 on: September 16, 2015, 09:09:55 pm »
Well, the source of zipper contains

     {$warning TODO implement EFS/language enooding using UTF-8}

so I think you can guess the answer :-)

Milsa

  • Sr. Member
  • ****
  • Posts: 328
Re: Zipper unit questions
« Reply #4 on: September 16, 2015, 09:36:48 pm »
IMHO, all is about encode dst parameter only. I have archive from TC. There is one file with slovak name ("archív"). I see in hex editor this sequence for this filename:
61 72 63 68 A1 76
It is in text:
archˇv
I try this:
TZipper.Entries.AddFileEntry(Src + s, UTF8ToAnsi('archˇv') + Dir + s));
It is working! All files have "archív" in beginning.

Well, the source of zipper contains

     {$warning TODO implement EFS/language enooding using UTF-8}

so I think you can guess the answer :-)
No in my version (Lazarus 1.4.2).

I think it is about correct encoding.
I work with Lazarus 4.0, FPC 3.2.2, date 2025-05-03
This information is actual to: 3rd Aug 2025

Michl

  • Full Member
  • ***
  • Posts: 226
Re: Zipper unit questions
« Reply #5 on: September 16, 2015, 10:27:21 pm »
2. It is in thread. Is it possible to abort TZipper.ZipAllFiles (end of application, etc.)?
I've made a progess form, where I show what file is in progress. There I put a "Abort" ToggleButton on it.
This Form is refreshed, when a new File is in progress - called by (Un-)Zipper.OnStartFile. There I return the result of the "Abort" Button. If the button was pressed I throw a exception and all zipping or unzipping stops.
It is maybe not the finest way but it works, whithout any rebuild of TZipper.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

Michl

  • Full Member
  • ***
  • Posts: 226
Re: Zipper unit questions
« Reply #6 on: September 16, 2015, 10:37:52 pm »
How can I insert entry to Zipper if I want UTF-8 characters in filenames readable in Total Commander?
Tipper.Entries.AddFileEntry(src, dst);
How can I change dst parameter?
I have slovak characters in filenames.
You can zip and unzip Unicode files (not only that files of your system codepage) fine with FPC 3.1.1 and enabled UTF8 in your Lazarus Project Options. Total Commander shows a wrong name of that files, but if you unzip these files with your own program the filenames are correct again.
« Last Edit: September 16, 2015, 10:42:15 pm by Michl »
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

Milsa

  • Sr. Member
  • ****
  • Posts: 328
Re: Zipper unit questions
« Reply #7 on: September 17, 2015, 03:42:31 pm »
Thank you all for your answers.
I work with Lazarus 4.0, FPC 3.2.2, date 2025-05-03
This information is actual to: 3rd Aug 2025

 

TinyPortal © 2005-2018