PureZIP library : ZIP / UNZIP files
Moderator: gnozal
Re: PureZIP library : ZIP / UNZIP files [password supported]
Thank you gnozal.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: PureZIP library : ZIP / UNZIP files [password supported]
Update (PB4.60 version)
Changes :
- new function : PureZIP_Archive_ReadInMemory()
Open a ZIP archive in memory (data section, resource, ...) for reading.
Changes :
- new function : PureZIP_Archive_ReadInMemory()
Open a ZIP archive in memory (data section, resource, ...) for reading.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: PureZIP library : ZIP / UNZIP files [password supported]
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().
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)
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: PureZIP library : ZIP / UNZIP files
Update (PB4.60 version -> V2.21)
Changes :
- PureZIP now uses API function PathMatchSpec() to analyze file masks with wildcards like * or ?.
Changes :
- PureZIP now uses API function PathMatchSpec() to analyze file masks with wildcards like * or ?.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: PureZIP library : ZIP / UNZIP files
Update (PB4.60 version -> V2.30)
Changes :
- new function PureZIP_Archive_CheckCRC() to check file integrity
Changes :
- new function PureZIP_Archive_CheckCRC() to check file integrity
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Re: PureZIP library : ZIP / UNZIP files
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.
I had no problem opening any of gnozal's other zip files that I downloaded.
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: PureZIP library : ZIP / UNZIP files
...I downloaded it too, no problem though so perhaps yours got broken on the way down. Try again.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: PureZIP library : ZIP / UNZIP files
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....
But at home on my home PC it downloaded and opened without a problem.
Strange....
Re: PureZIP library : ZIP / UNZIP files
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 ...
ps: a very usefull function (for me,at least) in combination with PureZIP_SetArchivePassword ...
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: PureZIP library : ZIP / UNZIP files
Sorry, PureZIP uses ZLIB, and there is no ZLIB function available for encrypting filenames.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!
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.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Re: PureZIP library : ZIP / UNZIP files
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.
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.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: PureZIP library : ZIP / UNZIP files
You may use the process library fonctions.ruslanx wrote:...how I can read info from stdout .. can you give a peace of code or example ..thx.
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")
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Re: PureZIP library : ZIP / UNZIP files
Thanks Gnozal !
Re: PureZIP library : ZIP / UNZIP files
This library is great, gnozal, thank you for keeping it going for what, 6 years now?!?
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: PureZIP library : ZIP / UNZIP files
Since 2005 (It was PB3.92 at the time iirc) !kenmo wrote:This library is great, gnozal, thank you for keeping it going for what, 6 years now?!?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).