PureZIP library : ZIP / UNZIP files

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

ROFLMAOTIPIMP!!

Post by Fangbeast »

[quote]I could add a sentence like Fangbeast : "As with all my apps, use this if you like it, don't use it if you don't like it. Suggestions on how to improve, bug reports are welcome. Stupid comments, criticisms, arrogant gum flapping etc, are not." :twisted:[/quote}

I had to do this as I used to get all sorts of arrogant, self serving comments from stupid people who never downloaded or tried my programs, feeble as they were. There are still way too many forum trolls willing to offern an opinion who never pass within 2 feet of anyone's code and they are a waste of space.

Of course; if someone download my rubbish software and actually tried it; then I don't mind comments to help me fix problems but I won't bother with idiots saying they don't like it etc, that's a waste of my time and I just don't care. I hope other authors feel the same way.

I won't even bother with twits and forum trolls who haven't taken the time to try my junk as I'm not a good enough coder to make really good stuff. People willing to help make it better are welcome.

You make good stuff Gnozal and I appreciate it. I won't ever make stupid comments about your code that have nothing to do with the software.

:):)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
PAMKKKKK
User
User
Posts: 18
Joined: Sun May 01, 2005 7:55 am
Location: Germany Braunschweig
Contact:

Post by PAMKKKKK »

The code are your examples: :lol:

Code: Select all

myzip.s = "c:\purebasic393\program\PureZIP-test.zip"
myzipfile1.s = "C:\PureBasic393\Program\PureCOLOR_TEST_2.pb"
myzipfile2.s = "C:\PureBasic393\Program\PureCOLOR_TEST_3.pb" If PureZIP_Archive_Create(myzip.s, #APPEND_STATUS_CREATE)
  PureZIP_Archive_Compress(myzipfile1.s, #False); <-- ERROR
  ;PureZIP_Archive_Compress(myzipfile2.s, #False); if commentet no ERROR
  PureZIP_Archive_Close()
EndIf
or yours modified:

Code: Select all

Procedure Zip_Pack()
  myFileinfo.PureZIP_FileInfo
  ;PureZIP_SetCallback(@PureZIP_Pack())
  If PureZIP_Archive_Create("c:\temp\test.zip", #APPEND_STATUS_CREATE)
    HideGadget(#Text_1, 0)
    HideGadget(#Progress_0,0)
    PureZIP_Archive_Compress("c:\temp\seggl.pb", #False); <-- ERROR
    PureZIP_Archive_Compress("c:\temp\test.mdb", #False); <-- ERROR
    HideGadget(#Text_1, 1)
    HideGadget(#Progress_0,1)
    PureZIP_Archive_Close() 
  EndIf
  
EndProcedure
Develop Standards, and you develop the World!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

What kind of error ?
I have just tested this code :

Code: Select all

myzip.s = "c:\purebasic394\program\PureZIP-test.zip" 
myzipfile1.s = "C:\PureBasic394\Program\PureCOLOR_TEST_2.pb" 
myzipfile2.s = "C:\PureBasic394\Program\PureCOLOR_TEST_3.pb"
If PureZIP_Archive_Create(myzip.s, #APPEND_STATUS_CREATE) 
  PureZIP_Archive_Compress(myzipfile1.s, #False); <-- ERROR 
  PureZIP_Archive_Compress(myzipfile2.s, #False); if commentet no ERROR 
  PureZIP_Archive_Close() 
EndIf
It works without error, and the ZIP file has the two files compressed.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
PAMKKKKK
User
User
Posts: 18
Joined: Sun May 01, 2005 7:55 am
Location: Germany Braunschweig
Contact:

Post by PAMKKKKK »

Are we in an endles loop ?
I'm posted the error two post before......

When i'm using the PureZIP_Archive_Compress() Function, i'm getting POLINK errors:
multiple data. section
_pballocate_memory
_pb_free_memory

When you could not recapitulate the Errors under WinXP (SP2) and PB 3.93, and you have no Idea where it comes from, our discusion has no sense.
Develop Standards, and you develop the World!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

PAMKKKKK wrote:Are we in an endless loop ?
Break
PAMKKKKK wrote:multiple data. section
_pballocate_memory
_pb_free_memory
Sorry, I forgot (to much threads in my head).
PAMKKKKK wrote:When you could not recapitulate the Errors under WinXP (SP2) and PB 3.93, and you have no Idea where it comes from, our discusion has no sense.
I don't have these errors with my Win98SE or WinNT4 and PB394. Maybe you use some other libraries or pb functions I don't use ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
PAMKKKKK
User
User
Posts: 18
Joined: Sun May 01, 2005 7:55 am
Location: Germany Braunschweig
Contact:

Post by PAMKKKKK »

ok!

i'm using:
WinXP (SP2)

PureBasic 3.93
jaPBe 2.5.4.22

userlibs:
PBOSL
MDB_LIB (Paul Leishow)
PV_gadgets (PurevisionXP,Paul Leishow)
RegINI_lib (Paul Leishow)
Develop Standards, and you develop the World!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

PAMKKKKK wrote:i'm using:
WinXP (SP2)
PureBasic 3.93
jaPBe 2.5.4.22
userlibs:
PBOSL
MDB_LIB (Paul Leishow)
PV_gadgets (PurevisionXP,Paul Leishow)
RegINI_lib (Paul Leishow)
The only thing we have in common is jaPBe !
I use PB3.94 - Win98SE/NT4 and none of these user libraries (and I don't own Purevision, so I can't test PV_Gadgets) !
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
PAMKKKKK
User
User
Posts: 18
Joined: Sun May 01, 2005 7:55 am
Location: Germany Braunschweig
Contact:

Post by PAMKKKKK »

OK!

I try it on an other (clean) Machine, and report later....

over and out
Develop Standards, and you develop the World!
PAMKKKKK
User
User
Posts: 18
Joined: Sun May 01, 2005 7:55 am
Location: Germany Braunschweig
Contact:

Post by PAMKKKKK »

@gnozal
Sorry for wasting your time! :oops:

In the German Forum a guy called Deeem2031, has created runtime optimized PBlibs: Math, Memory and StringExtension.
The StringExtension was the troublemaker..... :(

Now it is all right!

Thank you for your good work, and support!!!
Develop Standards, and you develop the World!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

PAMKKKKK wrote:@gnozal
Sorry for wasting your time! :oops:
No problem :D
PAMKKKKK wrote:Thank you for your good work, and support!!!
Thanks 8)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Library update

What's new :
- new function PureZIP_AsciiDosLatinUS_To_AsciiWinLatin1(), usefull when compacting files with non english filenames (with french accents for example).
Thanks Denis [French Forum] for the function.

Code: Select all

Procedure Display_Zip(FileName.s)
  ZIP_Handle_Lecture = PureZIP_Archive_Read(FileName)
  If ZIP_Handle_Lecture
    Nb_fichiers = PureZIP_GetFileCount(FileName)-1
    For i = 0 To Nb_fichiers
      PureZIP_GetFileInfo(FileName,i , @myFileinfo.PureZIP_FileInfo)
      String.s = PeekS(@myFileinfo\FileName)
      ;
      ; original [ASCII DOS LATIN US] essai_‚_…_‹_—_Š_‡.pb
      PureZIP_AsciiDosLatinUS_To_AsciiWinLatin1(@myFileinfo\FileName)
      ; corrected [ASCII WIN LATIN 1] essai_é_à_ï_ù_è_ç.pb
      ;
      AddGadgetItem(0, -1, String + Chr(10) + myFileinfo\FileName)
    Next
  EndIf
EndProcedure
;
If OpenWindow(0, 0, 0, 440, 494/2, #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_SystemMenu, "")
  If CreateGadgetList(WindowID())
    ListIconGadget(0, 10, 10, 420, (494/2)-20, "Name in ZIP [false]", (420/2)-7, #PB_ListIcon_MultiSelect | #PB_ListIcon_FullRowSelect | #PB_ListIcon_CheckBoxes)
    AddGadgetColumn(0, 1, "Corrected name [good]", (420 / 2) - 7)
    Display_Zip("C:\PureBasic394\Program\PureZIP-Denis[essai].zip")
    Repeat
      Select WaitWindowEvent()
        Case #PB_EventCloseWindow
          Break
      EndSelect
    ForEver
    PureZIP_Archive_Close()
  EndIf
EndIf
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

@gnozal,

Thanks for your nice PureZip library.

But I have a little question about it:
How can I zip an empty directory.
Reason:
I want zip the directory structure. Not the files only.

Thanks for your help.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

IceSoft wrote:@gnozal,

Thanks for your nice PureZip library.

But I have a little question about it:
How can I zip an empty directory.
Reason:
I want zip the directory structure. Not the files only.

Thanks for your help.
There is no function to do this in the lib, but :

Code: Select all

; Dir structure :
;
; +Purebasic394 
; |_+Program 
;   |_+Empty 
;     |_Empty 
;
PureZIP_AddFile("TEST.zip", "c:\PureBasic394\Program\empty", #True) 
PureZIP_AddFile("TEST.zip", "c:\PureBasic394\Program\empty\empty", #True) 
This works (archive is created), but returns #FALSE because no files are added !
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

Sorry not really.
The latest (deepest) directory called 'empty' is not a directory (It stored as a file with size 0)
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

IceSoft wrote:Sorry not really.
The latest (deepest) directory called 'empty' is not a directory (It stored as a file with size 0)
Sorry, you are right. I will try to fix it.
Last edited by gnozal on Mon Oct 10, 2005 2:54 pm, edited 1 time in total.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply