PackerEx_Include (extended PB pack functions)

Share your advanced PureBasic knowledge/code with the community.
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

PackerEx_Include (extended PB pack functions)

Post by Mischa »

It's a long time ago, i've been working at last with PB pack functions.

With this include you can create archives, file dates, 0 byte files and empty
directories inclusive.
You can add and remove items and you can append archives to executables
or any other files. The appended archives will be editable all the time.
Standalones and such thing will be no problem.

Functions:
AddEmptyDirectoryToPack
AddFileToPack
AddFullDirectoryToPack
AppendFilePack
CloseFilePack
CreateFilePack
DeleteFileInPack
ExtractPack
ExtractPackFile
ExtractPackFileToMem
FindPackFile
OpenFilePack
I've written a simple gui example and a little help file, too.

It's not perfect, but maybe helpful for someone.
(But maybe it's not the right stuff for PB rookies)

Download: http://www.thinkrelative.de/packerex.zip

Regards,
Mischa
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

This is sweet, if you could get password functionality and ability to get the packed file size (after packed), and compression, this would rival vBin :)
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Post by Mischa »

Update.
This is sweet, if you could get password functionality and ability to get the packed file size (after packed), and compression
Done.

->DOWNLOAD

Please test it.

Regards,
Mischa
User avatar
blueb
Addict
Addict
Posts: 1044
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post by blueb »

Mischa,

I downloaded and started testing your Packer functions. Seems very good so far.

I wanted to thank you for the include file and the source code to Packer.exe

I like looking at other developer's code, because I always learn many new tricks.

Thanks again :D
--blueb
Num3
PureBasic Expert
PureBasic Expert
Posts: 2810
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

ImageImageImageImageImage
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Do you have an example of using this against an EXE file? CreatePackFile doesnt work on those, but OpenFilePak does, however it gives errors whenever trying to add something:

Code: Select all

refkey.s=PeekS(*phrase)
Invalid memory access.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

I would like to update this to 4.0, and post the updated code or PM it to you, if you like?
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

Shannara wrote:I would like to update this to 4.0, and post the updated code or PM it to you, if you like?
That would be great! I need the update for converting my program to PB V4.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Post by Mischa »

This would be nice @Shannara
Thanks for your help.


Regards,
Mischa[/url]
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Mischa, thanks for making this available. Is it possible to update the release for PB4? Thanks.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

I've converted it to PB4 and send it to Mischa.

I could make it availible, if Mischa allows it.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Post by Mischa »

@Thorsten
You've send it? Can't find it here. :oops:

and of course you are allowed to making it avaible.

Regards,
Mischa
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Thanks Mischa & Thorsten1867 - this is an interesting lib for me. I've been trialling this v4 lib for a project, and I found a subtle issue (bug?) in FindPackFile().

Here's my situation. I have a pack file of containing a lot of images - e.g. in this order (most are omitted, what is shown are the important ones for this issue) -
quit-dn.png
.
.
t-dn.png
When I was trying to find 'T-dn.png' using:

Code: Select all

packID = FindPackFile("T-dn.png",0) 
I was always getting the 'quit-dn.png' id returned. Looking at the FindPackFile code, I could understand why (the FindString would pass for the case of 't-dn.png' & 'quit-dn.png' since both have the same substring). To fix this I changed the FindPackFile code from:

Code: Select all

Procedure FindPackFile(name.s,startid)
  element=SelectElement(PackItem(),startid)
  filefound=-1
  While element And filefound=-1
    If FindString(LCase(PackItem()\name),LCase(name),1)
      filefound=ListIndex(PackItem())
    EndIf
    element=NextElement(PackItem())
  Wend
  ProcedureReturn filefound
EndProcedure
to

Code: Select all

Procedure FindPackFile(name.s,startid)
  element=SelectElement(PackItem(),startid)
  filefound=-1
  While element And filefound=-1
    If FindString(LCase(PackItem()\name),LCase(name),1) = 1
      filefound=ListIndex(PackItem())
    EndIf
    element=NextElement(PackItem())
  Wend
  ProcedureReturn filefound
EndProcedure
which works for me. Not sure if that was the best solution (or if I used the function correctly - in that case, please let me know). I report this just in case someone else comes across this issue. Thanks again.
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re:

Post by Kuron »

Does anybody still have this or the last version posted by Mischa?
Best wishes to the PB community. Thank you for the memories. ♥️
Post Reply