Page 39 of 40

Re: PureZIP library : ZIP / UNZIP files [password supported]

Posted: Mon Jul 25, 2011 10:01 am
by c4s
Thank you gnozal.

Re: PureZIP library : ZIP / UNZIP files [password supported]

Posted: Wed Jul 27, 2011 12:36 pm
by gnozal
Update (PB4.60 version)

Changes :
- new function : PureZIP_Archive_ReadInMemory()
     Open a ZIP archive in memory (data section, resource, ...) for reading.

Re: PureZIP library : ZIP / UNZIP files [password supported]

Posted: Fri Sep 23, 2011 2:59 pm
by MachineCode
I can't seem to get PureZIP_AddFiles() to use FileMask.s with partial names. For example, I want to recurse a folder and only add files to my zip archive that have "PartialName" in their filename. But when I run the following code, 0 files are added. However, if I change "*PartialName*" to "*.*" then all files are added, as expected.

Does PureZIP not support this format of FileMask? If not, can I please request that it be added? Because at the moment I have to build my own directory list, filter the filenames manually, then add them one-by-one to the zip archive with PureZIP_Archive_Compress(). :(

Code: Select all

MyZIP.s = "C:\Test.zip"
MyFilesToZIP.s = "C:\Temp\*PartialName*" ; This fails, but using *.* works!
Debug PureZIP_AddFiles(MyZIP, MyFilesToZIP, #PureZIP_StorePathAbsolute, #PureZIP_Recursive)

Re: PureZIP library : ZIP / UNZIP files

Posted: Sat Sep 24, 2011 8:33 am
by gnozal
Update (PB4.60 version -> V2.21)

Changes :
- PureZIP now uses API function PathMatchSpec() to analyze file masks with wildcards like * or ?.

Re: PureZIP library : ZIP / UNZIP files

Posted: Thu Oct 27, 2011 9:30 am
by gnozal
Update (PB4.60 version -> V2.30)

Changes :
- new function PureZIP_Archive_CheckCRC() to check file integrity

Re: PureZIP library : ZIP / UNZIP files

Posted: Wed Nov 16, 2011 6:41 pm
by GWarner
I just tried to download PureZIP but when I try to open the zip file I'm told that it is corrupt. :(
I had no problem opening any of gnozal's other zip files that I downloaded.

Re: PureZIP library : ZIP / UNZIP files

Posted: Wed Nov 16, 2011 10:14 pm
by IdeasVacuum
...I downloaded it too, no problem though so perhaps yours got broken on the way down. Try again.

Re: PureZIP library : ZIP / UNZIP files

Posted: Thu Nov 17, 2011 12:12 am
by GWarner
Must be some with the network at work or my work computer because I tried downloading it a bunch of times with the same result.

But at home on my home PC it downloaded and opened without a problem.

Strange.... :?

Re: PureZIP library : ZIP / UNZIP files

Posted: Sat Jan 21, 2012 10:14 am
by ruslanx
Hi, a very usefull functions is missed like 'PureZIP_EcryptFileNames',if is posible (I know it is posible for you) can you add a function like this,thanks!

ps: a very usefull function (for me,at least) in combination with PureZIP_SetArchivePassword ...

Re: PureZIP library : ZIP / UNZIP files

Posted: Sat Jan 21, 2012 11:08 am
by gnozal
ruslanx wrote:Hi, a very usefull functions is missed like 'PureZIP_EcryptFileNames',if is posible (I know it is possible for you) can you add a function like this,thanks!
Sorry, PureZIP uses ZLIB, and there is no ZLIB function available for encrypting filenames.

Additionally, standard ZIP encryption is not very strong, so I would not use PkZip like archives for sensible data : 7-Zip offers very strong encryption, very good compression ratios (LZMA algo) and it's free.

Re: PureZIP library : ZIP / UNZIP files

Posted: Sat Jan 21, 2012 11:21 am
by ruslanx
Thanks Gnozal for quick answer ... I will use 7z.exe ... 7z a archive.7z -p123 -mhe *.txt

but I need a 'ProgressionCallback' .... I find a key for 7z -so (write data to stdout)
how I can read info from stdout .. can you give a peace of code or example ..thx.

Re: PureZIP library : ZIP / UNZIP files

Posted: Sat Jan 21, 2012 11:30 am
by gnozal
ruslanx wrote:...how I can read info from stdout .. can you give a peace of code or example ..thx.
You may use the process library fonctions.

Below an example executing PING and reading the result.

Code: Select all

Procedure.s ReadProgramStringSafe(ProgramNr) ; ReadProgramString does NOT support Unicode
  ;
  Protected Char.a, ReturnValue.s
  ;
  Static MyReadProgramOffset = 0
  ;
  Shared *MyReadProgramStringBuffer
  ;
  size = AvailableProgramOutput(ProgramNr)
  If size > 0
    ;
    Repeat
      ;
      ReadProgramData(ProgramNr, @Char, 1)
      PokeB(*MyReadProgramStringBuffer + MyReadProgramOffset, Char)
      MyReadProgramOffset + 1
      ;
      If AvailableProgramOutput(ProgramNr) = 0 Or MyReadProgramOffset > 255
        Break
      EndIf
      ;
    Until Char = $0A
    ;
    If Char <> $0A
      ReturnValue = ""
    Else
      PokeB(*MyReadProgramStringBuffer + MyReadProgramOffset, 0)
      ReturnValue = PeekS(*MyReadProgramStringBuffer, -1, #PB_Ascii)
      MyReadProgramOffset = 0
      ReturnValue = ReplaceString(ReturnValue, Chr(13), "")
      ReturnValue = ReplaceString(ReturnValue, Chr(10), "")
    EndIf
    ;
  EndIf
  ;
  ProcedureReturn ReturnValue
  ;
EndProcedure
Procedure IsRemotePCAvailable(RemotePC.s)
  ;
  Protected ConnectionOk, ResponseLine, Prog, FindLast, FindFirst, TimeOut.i
  ;
  Shared IsRemotePCAvailable_IP.s
  Shared *MyReadProgramStringBuffer
  ;
  IsRemotePCAvailable_IP = ""
  ;
  *MyReadProgramStringBuffer = AllocateMemory(2048)
  If *MyReadProgramStringBuffer
    ;
    Prog = RunProgram("ping.exe", RemotePC, GetTemporaryDirectory(), #PB_Program_Open | #PB_Program_Read | #PB_Program_Hide)
    If Prog
      TimeOut = ElapsedMilliseconds() + 5000
      Debug "IsRemotePCAvailable : START -> " + RemotePC
      While ProgramRunning(Prog)
        Response$ = ReadProgramStringSafe(Prog)
        If Response$
          Debug "---> " + Response$
          ResponseLine + 1
          If ResponseLine = 1
            IsRemotePCAvailable_IP = RemotePC
            FindFirst = FindString(Response$, "[", 1)
            If FindFirst
              FindLast = FindString(Response$, "]", FindFirst + 1)
              If FindLast
                IsRemotePCAvailable_IP = Mid(Response$, FindFirst + 1, FindLast - FindFirst - 1)
              EndIf
            EndIf
          ElseIf ResponseLine = 2
            If FindString(Response$, "TTL", 1)
              ConnectionOk = #True
            Else
              IsRemotePCAvailable_IP = ""
            EndIf
            KillProgram(Prog)
            Break
          EndIf
        EndIf
        If ElapsedMilliseconds() > TimeOut
          KillProgram(Prog)
          Break
        EndIf
      Wend
      If ResponseLine = 1
        IsRemotePCAvailable_IP = ""
      EndIf
      CloseProgram(Prog)
      Debug "IsRemotePCAvailable : END"
    Else
      ConnectionOk = -1
    EndIf
    ;
    FreeMemory(*MyReadProgramStringBuffer)
    ;
  Else
    ConnectionOk = -1
  EndIf
  ;
  ProcedureReturn ConnectionOk
  ;
EndProcedure
Debug IsRemotePCAvailable("localhost1")

Re: PureZIP library : ZIP / UNZIP files

Posted: Sat Jan 21, 2012 2:23 pm
by ruslanx
Thanks Gnozal !

Re: PureZIP library : ZIP / UNZIP files

Posted: Wed Feb 08, 2012 3:26 am
by kenmo
This library is great, gnozal, thank you for keeping it going for what, 6 years now?!?

Re: PureZIP library : ZIP / UNZIP files

Posted: Thu Feb 09, 2012 1:08 pm
by gnozal
kenmo wrote:This library is great, gnozal, thank you for keeping it going for what, 6 years now?!?
Since 2005 (It was PB3.92 at the time iirc) !