It is currently Thu May 28, 2020 3:20 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 600 posts ]  Go to page 1, 2, 3, 4, 5 ... 40  Next
Author Message
 Post subject: PureZIP library : ZIP / UNZIP files
PostPosted: Mon May 30, 2005 8:06 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
PureZIP library [ PB 3.9x-4.31 : V1.96 (FEB 25th 2009) ; PB 4.4x-4.5x : V2.00 (AUG 18th 2009) ; PB4.6x : V2.33 (MAR 9th 2012) ; PB5.0x : V2.33 (NOV 7th 2012) ; DLL : V2.00a (SEP 24th 2011) ]

Overview
Code:
The purpose of PureZIP is to handle ZIP files.
It uses the ZLIB library 1.2.3 (c) 1995-2004 Jean-loup Gailly and Mark Adler modified by Gilles Vollant.

The library supports classic PKZIP 2.04g archives :
- compression
- extraction
- encryption (ZIP 2.0)
... and for the latest versions :
- file deletion in archive
- file renaming in archive
- read archive from memory

Functions
PB3.94 : http://gnozal.ucoz.com/PureZIP.htm
PB4.xx : http://gnozal.ucoz.com/PureZIP_.htm

Example
Code:
Procedure CallbackForTest(file.s, PerCent.f)
  Debug StrF(PerCent, 2) + "%"
EndProcedure
;
myFileinfo.PureZIP_FileInfo
PureZIP_SetProgressionCallback(@CallbackForTest())
;
MyZIP.s = "C:\PureBasic393\Program\PureZIP\essai1\test.zip"
MyFilesToZIP.s = "C:\PureBasic393\Program\PureBriefLZ\*.*"
MyZIPOutPut.s = "C:\PureBasic393\Program\PureZIP\essai3\"
; Create archive
Debug PureZIP_AddFiles(MyZIP, MyFilesToZIP, #PureZIP_StorePathAbsolute, #PureZIP_Recursive)
; Extract files from archive
Debug PureZIP_ExtractFiles(MyZIP, "*.*", MyZIPOutPut, #TRUE)
; Count files in archive
Debug PureZIP_GetFileCount(MyZIP)
; Add memory bank to archive
Debug PureZIP_AddMemory(MyZIP, "MemoryTest.txt", @MyZIP, Len(MyZIP))
; On file more in archive :
Debug PureZIP_GetFileCount(MyZIP)
; Get files information
For i = 0 To PureZIP_GetFileCount(MyZIP) - 1
   Debug PureZIP_GetFileInfo(MyZIP,i , @myFileinfo)
   Debug "Number " + Str(i)
   Debug "Filename: " + myFileinfo\FileName
   Debug "Compressed Size: " + Str(myFileinfo\CompressedSize)
   Debug "Uncompressed Size: "+ Str(myFileinfo\unCompressedSize)
   Debug "--------------"
Next


Download
Only available for Purebasic Windows x86
PB3.94 : http://gnozal.ucoz.com/PureZIP.zip
PB4.0x - 4.10 : http://gnozal.ucoz.com/PureZIP_.zip
PB4.20 : http://gnozal.ucoz.com/PureZIP___.zip
PB4.3x : http://gnozal.ucoz.com/PureZIP_430.zip
PB4.4x : http://gnozal.ucoz.com/PureZIP_440.zip
PB4.5x : http://gnozal.ucoz.com/PureZIP_450.zip
PB4.6x : http://gnozal.ucoz.com/PureZIP_460.zip
PB5.0x : http://gnozal.ucoz.com/PureZIP_500.zip

Shared library (DLL) : http://gnozal.ucoz.com/PureZIP_DLL.zip [based on UserLib for PB4.xx code]

Notes :
1. Unicode : the ZIP standard doesn't support unicode files names. In a (PKZIP 2.04g) ZIP archive, the filenames are stored as OEM (MS-DOS, remember ?). The unicode version of PureZIP translates unicode to OEM and vice-versa. It works, but it is not 'true' unicode support...
Some newer archivers (like Pkzip 4.5+ / Winzip 11.2+) store unicode names using the UTF-8 standard. This method isn't compatible with older ZIP packers. Others store Unicode names in an extra field (like the Info-Zip method). But there is no real standard. If you need real unicode support, better use RAR or 7-ZIP.
2. Archive size : PureZIP (ZLIB) should support archive sizes up to 4GB. However ZIP is not recommended for big archives, because some compressors achieve much better compression ratio (RAR, 7-ZIP, ...), and ZIP doesn't have recovery capabilities like RAR for example.
3. GZ archives : PureZIP does not support GZ archives ; you may however try the following include + static ZLIB.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Last edited by gnozal on Tue Aug 18, 2009 11:51 am, edited 41 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 30, 2005 8:21 am 
Offline
Addict
Addict
User avatar

Joined: Mon Sep 20, 2004 3:52 pm
Posts: 1648
very cool, whats your license for this


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 30, 2005 8:25 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
dracflamloc wrote:
very cool, whats your license for this

My license : freeware :D
ZLIB's license : see the help files ( RTFM :wink: )

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Last edited by gnozal on Mon May 30, 2005 12:46 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 30, 2005 9:07 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 721
Location: Spain
:D Great. This facilitates much to me the work.... in my work.

Thank you

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 30, 2005 11:27 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 4:51 pm
Posts: 2808
Location: Portugal, Lisbon
Pretty cool !

Thanks !

_________________
Software: http://xipa.org
Elevator Maintenance: http://central-elevadores.pt
Good web hosting!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 30, 2005 12:40 pm 
Offline
Addict
Addict

Joined: Mon Jun 07, 2004 7:10 pm
Posts: 841
You deliver allways the best libraries.
Very good work :)


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Mon May 30, 2005 2:15 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Oct 16, 2003 8:30 pm
Posts: 1998
Location: North Florida
VERY VERY nice!

- np

*edit* Where does one find Pupils Library Importer?


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Mon May 30, 2005 2:49 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
NoahPhense wrote:
Where does one find Pupils Library Importer?

Here :
Pupil wrote:
Hmm, seems like i've forgotten about this, i'm sure i said something about releasing it at the time, but it never happened ;) i'm soo lazy :)

Anyway, for a limited time you can all download it from here (i don't know how long it'll be there so just grab it):
http://w1.319.telia.com/~u31913785/gnoz ... er_new.zip

The importer is a modified version of the original made by Fr34k. I've added a little workaround for LIB's with C calling convention and the possibility to save/load a project..

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Mon May 30, 2005 2:52 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Oct 16, 2003 8:30 pm
Posts: 1998
Location: North Florida
Thanks, much apprecited.

- np


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 30, 2005 6:50 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Sep 16, 2004 9:50 pm
Posts: 658
Location: France
Thanks a lot :D

_________________
DroopyLib/PBFastLib/HMod


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 30, 2005 7:54 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14064
Location: France
Cool lib :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 30, 2005 8:14 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 4:51 pm
Posts: 2808
Location: Portugal, Lisbon
Okey, got these problems here...

When i created my own functions i tested them on pebuilder.iso which is 340Mb, but i can't seem to pack the same file with PureZIP_AddFiles() it always throws an error...

Funny thing is, if i pack the entire directory where pebuilder.iso is, using *.* instead of the single file name it works!

So "D:\pebuilder\*.*" works, "D:\pebuilder\pebuilder.iso" does not!

Also the page file hits eats +50mb when packing and the CPU hit's 80%, and using my pack procedure i can compress 7 extra megabytes out of the same file...

When packing large files the callback seems to output:

Quote:
0.00%
20.00%
40.00%
60.00%
80.00%
100.00%
5
20.00%
40.00%
60.00%
80.00%
100.00%

_________________
Software: http://xipa.org
Elevator Maintenance: http://central-elevadores.pt
Good web hosting!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue May 31, 2005 8:24 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Num3 wrote:
Okey, got these problems here...

It's just V1 :oops:
- I have not tested it with big files, I didn't even think about it. Why would someone use ZIP on big files, when there is 7-ZIP :wink: ?
- The packing function is the same in PureZIP_AddFile() and PureZIP_AddFiles(), but you are right : PureZIP_AddFiles() only worked with wildcards :oops: : it's fixed now.
- The callback function is very primitive : it is only called before each zipOpenNewFileInZip().
- "using my pack procedure i can compress 7 extra megabytes out of the same file..." : What do you mean ? Your zip file is 7 Mb smaller ? I use #Z_DEFLATED & #Z_BEST_COMPRESSION, so I don't know ...
- "Also the page file hits eats +50mb when packing and the CPU hit's 80%" : I have add some delay in the loop, tell me if it helps.

Library updated

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue May 31, 2005 2:40 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 4:51 pm
Posts: 2808
Location: Portugal, Lisbon
Sorry i didn't mean to sound critic! Your work is excellent!

I can get 7 less mb out of the file, because i'm streaming the iso and maybe, just by plain luck, this file squeazes more like this...

I'll test your changes and report back !

_________________
Software: http://xipa.org
Elevator Maintenance: http://central-elevadores.pt
Good web hosting!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue May 31, 2005 2:48 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Num3 wrote:
Sorry i didn't mean to sound critic! Your work is excellent!
Constructive criticism and good bug report are always wellcome :D Congratulations also :lol:

Num3 wrote:
I'll test your changes and report back
Thanks. I will try to improve it, but I am no expert :wink:

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 600 posts ]  Go to page 1, 2, 3, 4, 5 ... 40  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye