7-zip32.dll wrapper

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

7-zip32.dll wrapper

Post by ts-soft »

This is a IncludeFile for 7-zip32.dll using static lib.

Unfortunately, I haven't found documentation (except in Japanese), but I
hope so, it's also useful

The folder-structure corresponds in the IncludePack used, 7-zip32.dll is in the
compilers subdirectory.
http://www.purebasic.fr/english/viewtop ... ncludepack

Example:

Code: Select all

XIncludeFile #PB_Compiler_Home + "Includes\7-zip32_Include.pbi"

Define.l HARC = SevenZipOpenArchive(0, #PB_Compiler_Home + "Includes\Libraries\sourcen\7-zip32.7z", #ARCEXTRACT_OPEN)
Define.INDIVIDUALINFO INFO

If HARC

  If Not SevenZipFindFirst.l(HARC, "*.*", @INFO)
    Debug INFO\szFileName

    While Not SevenZipFindNext(HARC, @INFO)
    
      Debug INFO\szFileName
      
    Wend
  EndIf
  SevenZipCloseArchive.l(HARC)
EndIf
The Not is the same as = 0 :wink:

Download 336kb

Feedback and Bug-Reports welcome

Greetings
Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Post by JCV »

Thanks. I might need this. :D
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

@JCV
You are welcome :D

Another small example to pack as 7z

Code: Select all

XIncludeFile #PB_Compiler_Home + "Includes\7-zip32_Include.pbi"

; this small programm makes a backup of purebasic with all subdirectories and files
; in the tempdir as 7z

Procedure BackUpPB()
  Protected Output.s = Space(255)
  Protected Destination.s = #DQUOTE$ + GetTemporaryDirectory() + "purebasic_bak" + #DQUOTE$
  Protected CmdLine$ =  "a -t7z -mx7 -ir!*.* " + Destination + " " + #DQUOTE$ + "*.*" + #DQUOTE$
  SetCurrentDirectory(#PB_Compiler_Home)
  If SevenZip(WindowID(0), CmdLine$, Output, 255) = 0
    ProcedureReturn #True
  EndIf
  Debug Output
  ProcedureReturn #False
EndProcedure

If OpenWindow(0, 0, 0, 140, 60, "PureBasic Backup", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
  If CreateGadgetList(WindowID(0))
    ButtonGadget(0, 30, 20, 80, 30, "Make Backup")
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Break
        Case #PB_Event_Gadget
          If EventGadget() = 0
            If BackUpPB()
              RunProgram("explorer.exe", "/e," + GetTemporaryDirectory(), ""); show the result
            EndIf
            Break
          EndIf
      EndSelect
    ForEver
  EndIf
EndIf
The Syntax is nearly the same as for the commandline-version of 7-Zip
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Psychophanta
Addict
Addict
Posts: 4969
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Post by Psychophanta »

Thanks, i was waiting for 7z to be available for management with PB :)
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

OMG! :shock: . ts-soft, I love you man! Thanks!

[Edit]
Can this be used in a commercial project? :?
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Inf0Byt3 wrote:Can this be used in a commercial project? :?
Is the same license as 7zip, LGPL, see copying.txt!
You can use in commercial projects!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Only one line changed to create a sfx-installer with passwort :wink:

Code: Select all

XIncludeFile #PB_Compiler_Home + "Includes\7-zip32_Include.pbi"

Procedure CreatePBSetup()
  Protected Output.s = Space(255)
  Protected Destination.s = #DQUOTE$ + GetTemporaryDirectory() + "purebasic_setup" + #DQUOTE$
  Protected CmdLine$ =  "a -sfx -mx7 -p -ir!*.* " + Destination + " " + #DQUOTE$ + "*.*" + #DQUOTE$
  SetCurrentDirectory(#PB_Compiler_Home)
  If SevenZip(WindowID(0), CmdLine$, Output, 255) = 0
    ProcedureReturn #True
  EndIf
  Debug Output
  ProcedureReturn #False
EndProcedure

If OpenWindow(0, 0, 0, 140, 60, "PureBasic Setup", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
  If CreateGadgetList(WindowID(0))
    ButtonGadget(0, 30, 20, 80, 30, "Make Setup")
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Break
        Case #PB_Event_Gadget
          If EventGadget() = 0
            If CreatePBSetup()
              RunProgram("explorer.exe", "/e," + GetTemporaryDirectory(), ""); show the result
            EndIf
            Break
          EndIf
      EndSelect
    ForEver
  EndIf
EndIf
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

This is awesome! Been waiting for a very long time for this. Thank you for your efforts!
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

I have found an english API-Description:
http://www.csdinc.co.jp/archiver/lib/7-zip32api-en.txt
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Small Update for unicode compatible

Changed some stringparameter to pseudotype ASCII
Some parameter as optional declared
In structures all strings as character defined! Read it with peeks!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
nrasool
User
User
Posts: 28
Joined: Tue Apr 26, 2005 9:55 am

Post by nrasool »

nice on Ts-Soft. Have you thought about putting this code and examples in your excellent PBOSL library?
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

ts-soft wrote:Unix is user friendly... it's just selective about who its friends are!
lol. :D

Thanks for the 7-zip!
Dare2 cut down to size
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: 7-zip32.dll wrapper

Post by dige »

is this project sill activ? the dl link is broken...
"Daddy, I'll run faster, then it is not so far..."
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: 7-zip32.dll wrapper

Post by ts-soft »

dige wrote:is this project sill activ?
No
dige wrote: the dl link is broken...
I think the DLL comes with PureFileMaster by Al90, or use the commandline-interface from 7zG.exe,
is easy to use.
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: 7-zip32.dll wrapper

Post by dige »

Could you pls put the old sources available again?
"Daddy, I'll run faster, then it is not so far..."
Post Reply