7zip archive for mozilla extension

Share your advanced PureBasic knowledge/code with the community.
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

7zip archive for mozilla extension

Post by oryaaaaa »

Code updated For 5.20+

I was not able to use PureZip to open Jar of Extension.
I do not understand the way though I want to make the library.
This is forcible Tips.

Thank you

Use usage - Easy Extension Editor (Alpha)
http://forum.oryaaaaa.com/viewtopic.php?t=140

Code: Select all

DataSection
  zip:
  ;     IncludeBinary "7za.exe"
  zip_e:
EndDataSection

Enumeration
  #SevenZip_Archive
  #SevenZip_Archive_jar
  #SevenZip_Extract
EndEnumeration

Procedure.b SevenZip(Mode, ArchiveFile.s, TargetDirectory.s)
  Protected file.l , cmdpath.s , zip_Run.l , zip_Outstr.s, runfile.s ; , WinTitle.s

  
  If Mode=#SevenZip_Archive
    cmdpath.s = "a -tzip "+Chr(34)+ArchiveFile+Chr(34)+" -r -mx=9 "+Chr(34)+TargetDirectory+"\*.*"+Chr(34)
    runfile.s =GetPathPart( ArchiveFile )+"7za.exe"
  ElseIf Mode=#SevenZip_Archive_jar
    cmdpath.s = "a -tzip "+Chr(34)+ArchiveFile+Chr(34)+" -r -mx=0 "+Chr(34)+TargetDirectory+"\*.*"+Chr(34)
    runfile.s =GetPathPart( ArchiveFile )+"7za.exe"
  ElseIf Mode=#SevenZip_Extract
    cmdpath.s = "x "+Chr(34)+ArchiveFile+Chr(34)+" -y"
    runfile.s = TargetDirectory+"\7za.exe"
  Else
    ProcedureReturn #False
  EndIf
  file.l = CreateFile(#PB_Any, runfile)
  If file
    WriteData(file, ?zip, ?zip_e-?zip)
    CloseFile(file)
    zip_Run = RunProgram(runfile, cmdpath,TargetDirectory, #PB_Program_Open| #PB_Program_Hide |#PB_Program_Read) 
    ;WinTitle.s=GetWindowTitle(#Window_okiraku)
    While ProgramRunning(zip_Run)
      ; WindowEvent() :Delay(1)
      zip_Outstr =ReadProgramString(zip_Run)
      ; SetWindowTitle(#Window_okiraku, WinTitle+Space(3)+zip_Outstr )
    Wend
    DeleteFile(runfile)
    ProcedureReturn #True 
  Else
    ProcedureReturn #False
  EndIf
EndProcedure

SevenZip(#SevenZip_Archive, "C:\test.zip" ,"C:\Program Files\PureBasic")
CreateDirectory("C:\Basic")
SevenZip(#SevenZip_Extract, "C:\test.zip" ,"C:\Basic")
DeleteFile("C:\test.zip")
End
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: 7zip archive for mozilla extension

Post by gnozal »

oryaaaaa wrote:I was not able to use PureZip to open Jar of Extension.
Strange. To my knowledge, .JAR files are simpy .ZIP files with another extension.
I have tested several .JAR files with PureZIP without a problem.
Could you send me such a .JAR file ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Post by oryaaaaa »

Sorry, When it is not Open but Archive is done, Firefox cannot read.

Firefox reads and processes the right of access for UNIX that doesn't exist in Windows. And, the developer of FirefoxExtension uses 7zip. The most correct way of making is to set the right of access on Linux and to do ZIP. It is impossible in PureZIP.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

oryaaaaa wrote:Sorry, When it is not Open but Archive is done, Firefox cannot read.

Firefox reads and processes the right of access for UNIX that doesn't exist in Windows. And, the developer of FirefoxExtension uses 7zip. The most correct way of making is to set the right of access on Linux and to do ZIP. It is impossible in PureZIP.
Ok, thanks.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply