SQLitening Support Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the SQLitening support forums!

Pages: [1] 2 3

Author Topic: ZLib Wrapper Routines  (Read 5441 times)

Rolf Brandt

  • Master Geek
  • ****
  • Posts: 382
    • View Profile
    • Taxi Dispatching Systems
ZLib Wrapper Routines
« on: February 23, 2011, 09:38:56 AM »

Hello Fred,
I was just toying with those routines:
http://www.sqlitening.com/support/index.php?topic=3254.0

Can they be used to create zip files from existing files or directories also?
Is there an example?
Logged
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Fred Meier

  • Master Geek
  • ****
  • Posts: 806
    • View Profile
Re: ZLib Wrapper Routines
« Reply #1 on: February 23, 2011, 10:07:52 AM »

Yes, these routines can read/write/create standard zip files.  I will work up some examples and post later.
Logged

Rolf Brandt

  • Master Geek
  • ****
  • Posts: 382
    • View Profile
    • Taxi Dispatching Systems
Re: ZLib Wrapper Routines
« Reply #2 on: February 23, 2011, 10:08:46 AM »

Thanks a lot, Fred.
Logged
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Fred Meier

  • Master Geek
  • ****
  • Posts: 806
    • View Profile
Re: ZLib Wrapper Routines
« Reply #3 on: February 24, 2011, 09:55:47 AM »

I downloaded and reviewed Zipper.Zip and found that Zipper.Bas is a
program that if you compile and run it will create a standard .Zip file
called Test.Zip and then unzip from it.  Let me know if you need more
examples? 
Logged

Rolf Brandt

  • Master Geek
  • ****
  • Posts: 382
    • View Profile
    • Taxi Dispatching Systems
Re: ZLib Wrapper Routines
« Reply #4 on: February 24, 2011, 10:08:28 AM »

Hello Fred,

what I really need is to programmatically zip an existing file - let's say a .bas or .exe file - or even a complete directory with several files. I could not find out how to do that with the zipper bas ruts.
Logged
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Fred Meier

  • Master Geek
  • ****
  • Posts: 806
    • View Profile
Re: ZLib Wrapper Routines
« Reply #5 on: February 24, 2011, 11:10:47 AM »

This snippet will zip the Ziipper.Bas file to Test.Zip.  Replace
PbMain in Ziipper.Bas with this snippet. 

I just now noticed that there are two i's in "Zipper", my mistake. 

Code: [Select]
   Local lsA as String
   Local lsZCB as String

   arZipFileInsertOpen "Test.Zip", lsZCB
   open "Ziipper.Bas" for binary lock shared as #1
   get$ #1, lof(#1), lsA
   close #1
   arZipFileInsertPut lsZCB, "Ziipper.Bas", lsA
   arZipFileInsertClose lsZCB

To do a folder, you would have to do someting like following:
Code: [Select]
   arZipFileInsertOpen "Test.Zip", lsZCB
   for each file in folder
      open file_name for binary lock shared as #1
      get$ #1, lof(#1), lsA
      close #1
      arZipFileInsertPut lsZCB, file_name, lsA
   next
   arZipFileInsertClose lsZCB

Logged

Rolf Brandt

  • Master Geek
  • ****
  • Posts: 382
    • View Profile
    • Taxi Dispatching Systems
Re: ZLib Wrapper Routines
« Reply #6 on: February 24, 2011, 11:35:17 AM »

That is great, Fred. Thanks a lot!
Logged
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Fredrick Ughimi

  • Master Geek
  • ****
  • Posts: 601
    • View Profile
    • Software Development Company
Re: ZLib Wrapper Routines
« Reply #7 on: July 11, 2017, 06:06:01 PM »

Hello,

Is there a way one can unzip a zipped file using the technique Fred posted a while ago?

Best regards,
Logged
Fredrick O. Ughimi

fughimi@yahoo.com
- Freedom lies in being bold -- Robert Frost, Poet

cj

  • Master Geek
  • ****
  • Posts: 700
    • View Profile
Re: ZLib Wrapper Routines
« Reply #8 on: July 11, 2017, 08:01:36 PM »

Yes.  I'm not sure this is from his code.                       https://forum.powerbasic.com/forum/user-to-user-discussions/third-party-addons/29121-litezip-liteunzip/page2?t=28376&page=2
copy sqliteningzlib.dll to zlib.dll or change calls.

FUNCTION PBMAIN

   LOCAL lsA, lsB AS STRING
   LOCAL lsZCB AS STRING

   ' zip it
   arZipFileInsertOpen "Text.Zip", lsZCB
   lsA = "This is some data to put in zip file."
   arZipFileInsertPut lsZCB, "MyFile.Txt", lsA
   arZipFileInsertClose lsZCB

   ' unzip it
   arZipFileGetFile "Text.Zip", 1, lsB
   ? lsB
END FUNCTION     
« Last Edit: July 14, 2017, 03:48:41 AM by cj »
Logged

Fredrick Ughimi

  • Master Geek
  • ****
  • Posts: 601
    • View Profile
    • Software Development Company
Re: ZLib Wrapper Routines
« Reply #9 on: July 12, 2017, 06:23:43 AM »

Hello CJ,

Cool. Really cool.

I would take a closer look later.

Thank you, CJ.
Logged
Fredrick O. Ughimi

fughimi@yahoo.com
- Freedom lies in being bold -- Robert Frost, Poet

cj

  • Master Geek
  • ****
  • Posts: 700
    • View Profile
Re: ZLib Wrapper Routines
« Reply #10 on: July 12, 2017, 06:27:59 AM »

I know there are also some routines that call SqliteningZlib.dll the same way SQLitening does using AuxRuts if you need them.
Logged

Fredrick Ughimi

  • Master Geek
  • ****
  • Posts: 601
    • View Profile
    • Software Development Company
Re: ZLib Wrapper Routines
« Reply #11 on: July 12, 2017, 06:32:01 AM »

Hello CJ,

Where are these keywords from:

arZipFile...

Don't think they are in the SQLitening help file.

Regards,

Logged
Fredrick O. Ughimi

fughimi@yahoo.com
- Freedom lies in being bold -- Robert Frost, Poet

cj

  • Master Geek
  • ****
  • Posts: 700
    • View Profile
Re: ZLib Wrapper Routines
« Reply #12 on: July 12, 2017, 08:00:05 AM »

They are from the routines in the download link to zipper.zip
Logged

Fredrick Ughimi

  • Master Geek
  • ****
  • Posts: 601
    • View Profile
    • Software Development Company
Re: ZLib Wrapper Routines
« Reply #13 on: July 12, 2017, 09:48:37 AM »

CJ,

I just tried downloading the zipper.zip and I got:

"404 - Attachment Not Found"
Logged
Fredrick O. Ughimi

fughimi@yahoo.com
- Freedom lies in being bold -- Robert Frost, Poet

Fredrick Ughimi

  • Master Geek
  • ****
  • Posts: 601
    • View Profile
    • Software Development Company
Re: ZLib Wrapper Routines
« Reply #14 on: July 12, 2017, 09:50:16 AM »

I just downloaded the one you uploaded.
Logged
Fredrick O. Ughimi

fughimi@yahoo.com
- Freedom lies in being bold -- Robert Frost, Poet
Pages: [1] 2 3