<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — gman.ZipEngine]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;fid=8&amp;type=atom" />
	<updated>2016-01-01T10:08:23Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/index.php</id>
		<entry>
			<title type="html"><![CDATA[ZipEngine and BMX 64 Bit?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=487&amp;action=new" />
			<summary type="html"><![CDATA[]]></summary>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2016-01-01T10:08:23Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=487&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Support for CRX (Chrome Extension Files)]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=471&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hi there, </p><p>the method ScanCentralHeader of Type TZipFileList can be changed to the following code (or similar), in order to make extraction of CRX (Chrome Extension Files) possible via zipengine.</p><div class="codebox"><pre><code>    

    Rem
        bbdoc: Scans the central header for files.  Returns true if successful.
    End Rem
    Method ScanCentralHeader:Int()
    
        SeekStream(zipFile, 0)
        Local magic_number:Int = ReadInt(zipFile);
        Local zip_start_pos:Int = 0;
        
        &#039; CRX FILE (Google Chrome Extension File), see: http://developer.chrome.com/extensions/crx.html
        If magic_number = $34327243 Then
            
            zip_start_pos:+4;
            
            ReadInt(zipFile); &#039; CRX Version
            zip_start_pos:+4;
            
            zip_start_pos:+ReadInt(zipFile); &#039; length of crx public key
            zip_start_pos:+4;
            
            zip_start_pos:+ReadInt(zipFile); &#039; length of crx signature
            zip_start_pos:+4;
            
            SeekStream(zipFile, zip_start_pos);
            magic_number:Int = ReadInt(zipFile);
            
        EndIf
        
        &#039; first check to see if its even a valid ZIP file
        If magic_number &lt;&gt; $04034b50 Then 
            DebugLog(&quot;Invalid ZIP file!&quot;)
            Return False
        EndIf
        
        Local header_start:Int = 0
        
        &#039; jump to the end
        SeekStream(zipFile, StreamSize(zipFile) - 4)
        
        &#039; seek the end central directory structure
        While Not StreamPos(zipFile) = 0
            Local sig:Int = ReadInt(zipFile)
            If sig = $06054b50 Then
                &#039; jump to start of central dir location    
                SeekStream(zipFile, StreamPos(zipFile) + 12)
                header_start = ReadInt(zipFile)
                Exit                
            Else
                &#039; rewind 3 bytes and try again
                SeekStream(zipFile, StreamPos(zipFile) - 5)
            EndIf
        EndWhile
    
        &#039; if we found the header, then process
        If Not header_start Then 
            DebugLog(&quot;unable to locate central directory!&quot;)
            Return False
        EndIf
        
        header_start:+zip_start_pos;
        
        &#039; seek to the start of the central directory
        SeekStream(zipFile, header_start)
        
        While True And Not Eof(zipFile)
            Local entry:SZipFileEntry = SZipFileEntry.Create()
            If entry.header.fill(zipFile) Then
                FileList.AddLast(entry)

                &#039; read filename
                entry.zipFileName = entry.header.FileName            
                extractFilename(entry)                                 
            Else
                Exit
            EndIf
        EndWhile
    
        Return True
    EndMethod</code></pre></div><p><img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></summary>
			<author>
				<name><![CDATA[paramausi]]></name>
				<uri>https://gprogs.com/profile.php?id=355</uri>
			</author>
			<updated>2013-02-13T15:41:48Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=471&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[zwObject.RemoveFile()?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=467&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hi!</p><p>What&#039;s the best way to remove a certain file from multiple zip files (1000+) without having to recreate them manually each time?</p><p>A command like &quot;zwObject.RemoveFile(filename)&quot; would be quite helpful here.</p><p>Grisu</p>]]></summary>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2012-08-19T09:13:14Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=467&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[v2.15 - undefined reference again... :)]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=459&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hi there!</p><p>Thanks for updating this great module. </p><p>Sadly, I get a similar error message with your latest release:<br />Linking:prp044_04_zombie_bunny_fin.exe<br />C:/BlitzMax/mod/gman.mod/zipengine.mod/zipengine.release.win32.x86.a(zipengine.bmx.release.win32.x86.o):(code+0x670): undefined reference to `zipWriteInFileInZipUTF8&#039;<br />C:/BlitzMax/mod/gman.mod/zipengine.mod/zipengine.release.win32.x86.a(zipengine.bmx.release.win32.x86.o):(code+0x98a): undefined reference to `zipWriteInFileInZipUTF8&#039;</p><p>Can you fix this issue too?</p><p>Grisu</p><p>P.S.: OS: Win7 (64 Bit) with BMX 1.48, MinGW 4.6.1 and FASM 1.70.</p>]]></summary>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2012-04-20T20:05:32Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=459&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[ZipRamStream.ZCreate fails with size=0]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=440&amp;action=new" />
			<summary type="html"><![CDATA[]]></summary>
			<author>
				<name><![CDATA[plash]]></name>
				<uri>https://gprogs.com/profile.php?id=251</uri>
			</author>
			<updated>2011-05-13T18:55:28Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=440&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Unicode streams]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=437&amp;action=new" />
			<summary type="html"><![CDATA[]]></summary>
			<author>
				<name><![CDATA[siread]]></name>
				<uri>https://gprogs.com/profile.php?id=315</uri>
			</author>
			<updated>2011-04-13T09:00:04Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=437&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[error: storage size of 'tm_buf' isn't known]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=424&amp;action=new" />
			<summary type="html"><![CDATA[<p>is this a common thing or am I doing something wrong?</p>]]></summary>
			<author>
				<name><![CDATA[EdzUp]]></name>
				<uri>https://gprogs.com/profile.php?id=294</uri>
			</author>
			<updated>2010-07-29T20:46:44Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=424&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[v2.11 - Undefined reference?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=422&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hi</p><p>With bmx 1.40 (win7, 64 Bit) I&#039;m getting an error when I try to recompile the new module:<br />/BlitzMax/mod/gman.mod/zipengine.mod/zipengine.release.win32.x86.a(zipengine.bmx.release.win32.x86.o): undefined reference to `bmx_fill_fopen_filefunc&#039;</p><p>v2.10 works fine though?!</p><p>Grisu</p>]]></summary>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2010-07-24T23:46:52Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=422&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[zrObject.ExtractFileToDisk - Unhandled Exception]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=421&amp;action=new" />
			<summary type="html"><![CDATA[<div class="codebox"><pre><code>Function Extract_Zip()

      Local zrObject:ZipReader = New ZipReader
      Local Extracted_file:String
      Local Scr_file:String 

      SetGadgetText(Curr_Msg_Lab,&quot;Extracting File: &quot;)
    
      If ( zrObject.OpenZip(ServerZIPFile) ) Then

      For Local i:Int=1 To zrObject.getFileCount()-1
                 Scr_file:String=zrObject.getFileInfo(i).zipFileName  
                 Extracted_file=Replace(Scr_file,&quot;Pocket Radio Player/&quot;,&quot;&quot;)

           If Extracted_file.find(&quot;.&quot;)&gt;0 Then zrObject.ExtractFileToDisk(Scr_file, Extracted_file, True) &lt;- This one!!

         Next

        zrObject.CloseZip()
    End If
        
End Function</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2010-07-24T23:05:22Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=421&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Directory structure]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=420&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hi,</p><p>I wrote a function that creates the needed directory structure and extracts all files in a zip.<br />Now i want to add a complete directory, including subdirectorys, to a new empty zip.</p><p>But, how do i create a directory structure inside a new empty zip?</p>]]></summary>
			<author>
				<name><![CDATA[Ferret]]></name>
				<uri>https://gprogs.com/profile.php?id=262</uri>
			</author>
			<updated>2010-06-30T14:16:56Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=420&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[ZipEngine and incbin]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=410&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hello, should it be possible to open a zip that is incbinned?</p><p>ei., zip.OpenZip(&quot;incbin::myzip.zip&quot;)</p><p>Doesn&#039;t seem to be working, so I guess the next question is, can it be make to work if not? <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Thanks!</p>]]></summary>
			<author>
				<name><![CDATA[peterigz]]></name>
				<uri>https://gprogs.com/profile.php?id=257</uri>
			</author>
			<updated>2010-03-12T00:54:23Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=410&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Addfile: Change source and destination dir+filename?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=383&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hello!</p><p>Is it possible to change the source and destination dir+filename when creating a zip?</p><p>Somewhat like that:</p><p>zwObject.OpenZip(&quot;testfile.zip&quot;, False) )<br />zwObject.AddFile(&quot;Source\station.txt&quot;, &quot;ZipDir\stationzip.txt, password)<br />zwObject.CloseZip()</p><p>Thanks.<br />Grisu</p>]]></summary>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2009-08-18T21:50:38Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=383&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Bug: ZIPE not freeing up memory / closing stream after usage?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=382&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hi!</p><p>In my &quot;Pocket Radio Player&quot; I have a memory leak when I use the stream functions of your module a lot.<br />It also seems that the zip file is still &quot;locked&quot;, even when I already have opened another one.</p><p>Example line:<br />ButtoIco_stop:TIconstrip=LoadIconStrip(&quot;zipe::skins\&quot;+filename+&quot;::prp_stop.png&quot;)</p><p>Is there a way to force the wrapper to close the stream / zip file and free the memory allocated?<br />The bmx Garbage Collector doesn&#039;t help here at all.</p><p>Thanks.</p><p>Grisu</p>]]></summary>
			<author>
				<name><![CDATA[Grisu]]></name>
				<uri>https://gprogs.com/profile.php?id=264</uri>
			</author>
			<updated>2009-08-18T18:11:50Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=382&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[gman]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=381&amp;action=new" />
			<summary type="html"><![CDATA[<p>do you have any simple code for ading a dir to a zip keeping the file structure as i have tried to play about with it but im not getting to far here is my code so far</p><div class="codebox"><pre><code>SuperStrict

Import maxGui.Drivers
Import gman.zipengine

Local myStyle:Int                            = WINDOW_TITLEBAR | WINDOW_STATUS | WINDOW_CLIENTCOORDS 
Local myWinSX:Int                            = 636
Local myWinSY:Int                            = 471
Local myDir:String                           = Null 
Local myFile:String                          = Null 
Local myFolder:Int                           = Null 
Local myPassword:String                      = Null 
Local myZipFile:ZipWriter                    = New ZipWriter
Local myWindow:TGadget                       = CreateWindow( &quot;Zip Maker&quot;, 195, 16, myWinSX, myWinSY, Null, myStyle )
Local myTreeView:TGadget                     = CreateTreeView( 140, 1, 490, 465, myWindow, Null )
Local myDirChoice:TGadget                    = CreateButton( &quot;Choose Dir&quot;, 9, 270, 121, 33, myWindow, BUTTON_OK )
Local mySetPassword:TGadget                  = CreateButton( &quot;Choose Password&quot;, 9, 304, 121, 35, myWindow, BUTTON_OK )
Local myCreateZip:TGadget                    = CreateButton( &quot;Create Zip&quot;, 9, 339, 121, 37, myWindow, BUTTON_OK )
Local myExit:TGadget                         = CreateButton( &quot;Exit&quot;, 8, 378, 122, 86, myWindow, BUTTON_OK )



Repeat 
 WaitEvent()
 Select EventID()
  Case EVENT_GADGETACTION
   Select EventSource()
    Case myDirChoice
         myDir = RequestDir( &quot;Select a Folder&quot; )
         myFolder = ReadDir( myDir )
         SetStatusText myWindow, myDir
         Repeat 
           myFile = NextFile( myFolder )
           If myFile=&quot;..&quot; Or myFile=&quot;.&quot; Or myFile=Null Then
              NextFile( myFolder )
           Else
              AddTreeViewNode( myFile, TreeViewRoot( myTreeView ) )  
           EndIf    
         Until myFile = Null 
    Case mySetPassword
         Local myChildWindow:TGadget         = CreateWindow:TGadget( &quot;Password&quot;, 113, 96, 376, 121, myWindow, WINDOW_TITLEBAR | WINDOW_CHILD )
         Local myPasswordEntry:TGadget       = CreateTextField:TGadget( 32, 25, 302, 20, myChildWindow, TEXTFIELD_PASSWORD )
         Local myOk:TGadget                  = CreateButton:TGadget( &quot;Ok&quot;, 133, 59, 104, 22, myChildWindow, BUTTON_OK )
         Local myLabel:TGadget               = CreateLabel:TGadget( &quot;Enter Password&quot;, 32, 3, 301, 14, myChildWindow, Null ) 
         Local mySelection:Int               = Null 
         Repeat 
           WaitEvent()
            Select EventID()
             Case EVENT_GADGETACTION
              Select EventSource()
               Case myOk   
                myPassword = GadgetText( myPasswordEntry ) 
                HideGadget( myChildWindow )
                FreeGadget( myChildWindow )
                mySelection = 1
              EndSelect 
           EndSelect
         Until mySelection = 1                          
    Case myCreateZip
         myFolder = ReadDir( myDir )
         ChangeDir( myDir )
         SetStatusText myWindow, myPassword
         If ( myZipFile.OpenZip( myDir+&quot;-data.zip&quot;, False ) ) Then
            Repeat  
             myFile = NextFile( myFolder )        
             If myFile=&quot;..&quot; Or myFile=&quot;.&quot; Or myFile=Null Then
                NextFile( myFolder ) 
              Else 
                Delay(4000) 
                SetStatusText myWindow, myFile   
                myZipFile.AddFile( myFile, myPassword ) 
              EndIf                
            Until myFile = Null
            myZipFile.CloseZip()
            SetStatusText myWindow, &quot;Zip File Complete!&quot;
         End If
    Case myExit
     End 
   End Select 
 End Select 
Forever</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[DaY]]></name>
				<uri>https://gprogs.com/profile.php?id=9</uri>
			</author>
			<updated>2009-07-27T20:59:51Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=381&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Bug appending to an empty zip?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?id=359&amp;action=new" />
			<summary type="html"><![CDATA[<p>Hello, if you create a new zip file then close it again so you have a blank zip, then later open it again to append to nothing seems to get added to the zip. Here&#039;s an example adapted from the last bug example:</p><div class="codebox"><pre><code>SuperStrict

Framework brl.basic
Import gman.zipengine
Import brl.pixmap
Import brl.pngloader

Local zip:ZipWriter = New ZipWriter
zip.OpenZip(&quot;test.zip&quot;, False)
zip.CloseZip()

&#039;Create 10 pixmaps and save into a stream in the format:
&#039;Int (size of png)
&#039;Png file
&#039;Int (size of png)
&#039;Png file
&#039;Int (size of png)
&#039;Png file
&#039;.. etc

Local iconbank:TBank = CreateBank()
Local tempstream:TStream = WriteStream(iconbank)
For Local c:Int = 1 To 10
    Local pixmap:TPixmap = CreatePixmap(32, 32, PF_RGBA8888)
    pixmap.WritePixel(c, c, $FFFFFFFF)
    Local tempbank:TBank = CreateBank()
    SavePixmapPNG(pixmap, tempbank)
    tempstream.WriteInt(tempbank.Size())
    WriteBank(tempbank, tempstream, 0, tempbank.Size())
Next

SaveBank(iconbank, &quot;testfile&quot;)
zip.OpenZip(&quot;test.zip&quot;, True)
&#039;add the stream and file to the zip
zip.AddStream(tempstream, &quot;teststream&quot;)
zip.AddFile(&quot;testfile&quot;)
zip.CloseZip()
End</code></pre></div><p>This should create a zip with 2 file in it, but the zip is empty... But I&#039;m not sure if this is normal behaviour <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Thanks!</p>]]></summary>
			<author>
				<name><![CDATA[peterigz]]></name>
				<uri>https://gprogs.com/profile.php?id=257</uri>
			</author>
			<updated>2009-02-16T21:27:27Z</updated>
			<id>https://gprogs.com/viewtopic.php?id=359&amp;action=new</id>
		</entry>
</feed>
