It is currently Sat Apr 21, 2018 11:41 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 600 posts ]  Go to page Previous  1 ... 36, 37, 38, 39, 40
Author Message
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Wed Feb 29, 2012 5:13 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2235
I tried to change one single file in a sub directory of a large zip file and failed so far...

...the first problem have been Memory Errors when executing PureZIP_DeleteFile when the archive is not in a proper format (no problems have been seen with all other commands) - workaround extracting and compacting all files to create a compatible archive.

...but now I am still not able to remove the file in the sub directory and so I get multiple files with the same name in the archive. Is there a simple method to overwrite an existing file?

Code:
Archiv.s="Test.zip"
Datei.s="subdir\file.txtl"
                  
Global Buffer.s
Global Ok.i

If PureZIP_Archive_Read(Archiv)
   myfileinfo.PureZIP_FileInfo
   If PureZIP_Archive_Locate(Datei)=#UNZ_OK
      Buffer=Space(myFileinfo\unCompressedSize)
      If PureZIP_Archive_ExtractMem(@Buffer,Len(Buffer))>0
         Buffer=Left(Buffer,123)+"***"+Mid(Buffer,123)
         Ok=1
      EndIf
   EndIf
   PureZIP_Archive_Close()
EndIf

If Ok
   Debug PureZIP_DeleteFile(Archiv,Datei)
   If PureZIP_Archive_Create(Archiv,#APPEND_STATUS_ADDINZIP)
      Debug PureZIP_Archive_CompressMem(Datei,@Buffer,Len(Buffer)-1)
      PureZIP_Archive_Close()
   EndIf
EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Thu Mar 01, 2012 3:10 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Michael Vogel wrote:
...the first problem have been Memory Errors when executing PureZIP_DeleteFile when the archive is not in a proper format (no problems have been seen with all other commands) - workaround extracting and compacting all files to create a compatible archive.
PureZIP_DeleteFile() uses some low level ZLIB functions, so a corrupt archive may be a problem. I fixed a memory allocation issue, so maybe this is fixed.
Michael Vogel wrote:
...but now I am still not able to remove the file in the sub directory and so I get multiple files with the same name in the archive. Is there a simple method to overwrite an existing file?
I have uploaded a new version, it should work now with your code. You need to add a PureZIP_Archive_FileInfo() call before using myFileinfo\unCompressedSize though.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Fri Mar 02, 2012 6:47 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2235
gnozal wrote:
I fixed a memory allocation issue, so maybe this is fixed.

Haven't changed anything here, I was trying to delete a file within MS office files (dotx, xlam, ppam) which seem to have been packed without any compression.

gnozal wrote:
I have uploaded a new version, it should work now with your code. You need to add a PureZIP_Archive_FileInfo() call before using myFileinfo\unCompressedSize though.


Oh, must have deleted the PureZIP_Archive_FileInfo() line in my last code example. :oops:

Your new version do show the same effects than before, I fear I must do something wrong. I use this small zip file for the following code:
Code:
Archiv.s="Zip.zip"
Datei.s="Dir1\Text1.txt"

Global Buffer.s="Hallo"
Global Ok

#Banner="***Yippieh***"

If PureZIP_Archive_Read(Archiv)
   myfileinfo.PureZIP_FileInfo
   If PureZIP_Archive_Locate(Datei)=#UNZ_OK
      PureZIP_Archive_FileInfo(@myFileinfo)
      Buffer=Space(myFileinfo\unCompressedSize)
      If PureZIP_Archive_ExtractMem(@Buffer,Len(Buffer))>0
         f=FindString(Buffer,"Change")
         If f
            f=FindString(Buffer,"[",f)
            e=FindString(Buffer,"]",f+1)
            Debug "Old Text: "+Mid(Buffer,f+1,e-f-1)
            If e
               Debug "New Text: "+#Banner
               Buffer=Left(Buffer,f)+#Banner+Mid(Buffer,e)
               Ok=#True
            EndIf
         EndIf
      EndIf
   EndIf
   PureZIP_Archive_Close()
EndIf

If Ok
   PureZIP_Archive_Close()
   Debug PureZIP_DeleteFile(Archiv,Datei)
   If PureZIP_Archive_Create(Archiv,#APPEND_STATUS_ADDINZIP)
      Debug PureZIP_Archive_CompressMem(Datei,@Buffer,Len(Buffer)-1)
      PureZIP_Archive_Close()
   EndIf
EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Sat Mar 03, 2012 9:25 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Michael Vogel wrote:
Haven't changed anything here, I was trying to delete a file within MS office files (dotx, xlam, ppam) which seem to have been packed without any compression.
I tried PureZIP_DeleteFile() on an archive with no compression (store) : no problem.
It seems to be something else.
Michael Vogel wrote:
Your new version do show the same effects than before, I fear I must do something wrong. I use this small zip file for the following code...
ZIP archives store the '\' in unix style '/'.
I have updated PureZIP_DeleteFile() in the library to handle the '\' correctly.

I hope it works as expected now : version 2.33 (MAR 9th 2012).

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Fri Nov 23, 2012 9:34 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 985
Location: Russia
How can I open several files at once?
Function PureZIP_Archive_Read() only works with a single archive.

_________________
Library XP_Menu_Lib - office menu; HID_Lib - USB Library
Torrent client - pbTorrent (source code); Create driver in PureBasic.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Sat Nov 24, 2012 10:22 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
User_Russian wrote:
Function PureZIP_Archive_Read() only works with a single archive.
Correct.
User_Russian wrote:
How can I open several files at once?
Currently, you can't.
If you need this feature, have a look at MiniZip

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Sun Dec 23, 2012 3:14 am 
Offline
Addict
Addict

Joined: Sat Jul 11, 2009 4:57 am
Posts: 930
Location: United States
Following code crashes, using PB5 and the dll version.

Code:
Procedure openzip(filename.s)
   Define myFileinfo.PureZIP_FileInfo
   Define ReturnValue.l
If PureZIPDLL_Archive_Read(filename)
   ReturnValue.l = PureZIPDLL_Archive_FindFirst()
   While ReturnValue = #UNZ_OK
      Debug PureZIPDLL_Archive_FileInfo(@myFileinfo)
      Debug "Filename: " + myFileinfo\FileName
      Debug "Compressed Size: " + Str(myFileinfo\CompressedSize)
      Debug "Uncompressed Size: "+ Str(myFileinfo\unCompressedSize)
      ReturnValue = PureZIPDLL_Archive_FindNext()
   Wend
   PureZIPDLL_Archive_Close()
 EndIf
 EndProcedure


Should add that I receive an IMA at EndProcedure.

_________________
▓▓▓▓▓▒▒▒▒▒░░░░░


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Mon Dec 24, 2012 2:50 am 
Offline
Addict
Addict

Joined: Sat Jul 11, 2009 4:57 am
Posts: 930
Location: United States
Sorry for the double post but it seems the DLL version is extremely unstable. PureZIPDLL_AddMemory("D:\test.zip", "folder/test.txt", @"Hello world", len("Hello world")) doesn't write contents to the file entirely, or the contents become something like, "4050 64".

Even the examples do this. Any idea whats going on here?


[edit] disregard this post. I think this may actually be an error with my system itself.

_________________
▓▓▓▓▓▒▒▒▒▒░░░░░


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Sat Aug 10, 2013 12:46 am 
Offline
New User
New User

Joined: Sat Aug 03, 2013 12:56 pm
Posts: 1
Is it possible to upgrade PureZip DLL to make it possible to do file deletion in archive, file renaming in archive, and read archive from memory? Thank you.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Tue Aug 27, 2013 4:44 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Jul 18, 2013 4:58 am
Posts: 105
zeehteam wrote:
Is it possible to upgrade PureZip DLL to make it possible to do file deletion in archive, file renaming in archive, and read archive from memory? Thank you.

PureBasic supports archives since 5.10 I think, might wanna give them a look. It can do a couple of things you're looking to do.

http://www.purebasic.com/documentation/ ... index.html

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Sat Aug 31, 2013 6:44 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5761
Location: Wales, UK
ruslanx wrote:
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.

Another way:
Code:
 *Buffer = AllocateMemory(1024 * SizeOf(character))

   i7zip = RunProgram("C:\7zip\7za.exe", " a -t7z my_archive.7z C:\MyTemp", "C:\", #PB_Program_Open | #PB_Program_Hide | #PB_Program_Read)
If i7zip

          While ProgramRunning(i7zip)

                    If AvailableProgramOutput(i7zip)

                           ReadProgramData(i7zip,*Buffer,1024)
                                 Debug PeekS(*Buffer, 1024, #PB_UTF8)
                    EndIf
          Wend

          CloseProgram(i7zip)
EndIf


Unfortunately, it seems that PB receives the 7zip output when the whole task is complete, so you can't use the output to show progress. Did you find a better way with 7zip's -so flag? I can't get that option to work.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Thu Dec 19, 2013 9:36 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Oct 03, 2007 2:38 pm
Posts: 160
Location: To the deal with a pepper
Hi
Compiling with PB 5.21 LTS, the compiler says:
PB library missing Misc

PB has been removed it.
What is the solution?


Last edited by graves on Sat Dec 21, 2013 10:48 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Thu Dec 19, 2013 1:22 pm 
Online
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 954
Gnozal's libraries are only for this PB Version, their compiled for. Latest Update of his libs is to fit to PB5.0x (Tailbite).

If you want to use gnozal's libs with a newer version of PB, you have to wait for gnozal's update....

By the way... Where is Gnozal ? Normally his libs are converted to the newest PB version at real-time ;)

_________________
PureBasic 5.46 LTS / 5.62 (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 32GB RAM | iChill GeForce GTX 980 X4 Ultra | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Thu Dec 19, 2013 1:52 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 5:24 pm
Posts: 7581
> PureBasic supports archives since 5.10 I think

But not with passwords, so I still need Gnozal's lib for now.

_________________
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.


Top
 Profile  
Reply with quote  
 Post subject: Re: PureZIP library : ZIP / UNZIP files
PostPosted: Thu Dec 19, 2013 11:31 pm 
Online
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 954
PB wrote:
> PureBasic supports archives since 5.10 I think

But not with passwords, so I still need Gnozal's lib for now.


Give a try to HeX0r's or TS-Soft's includes here in the forum ....

_________________
PureBasic 5.46 LTS / 5.62 (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 32GB RAM | iChill GeForce GTX 980 X4 Ultra | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 600 posts ]  Go to page Previous  1 ... 36, 37, 38, 39, 40

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye