Results 1 to 3 of 3

Thread: Next thinBasic: ZIP file handling

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Next thinBasic: ZIP file handling

    Next thinBasic will have a set of new functions inside zLib module able to handle ZIP files.

    So far I've added the following:
    • ZLib_Version
    • ZLib_AddToZip(File, ZipFile)
    • ZLib_ListFiles(ZipFile)
    • ZLib_AddToZipEx(File, ZipFile, Flags)
    • ZLib_FindFile(File, ZipFile)
    • ZLib_ExtractFromZip(ZipFile, OutputDir)

    I'm still working on those functions (and also working on understanding zLib library) so maybe the syntax will change for some of them.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Eros,

    this is looking great.

    I have a one note - in line with FILE module syntax, I would expect the ZipFile to be always the first parameter in the procedural interface, making it:

    • ZLib_Version
    • ZLib_AddToZip(ZipFile, File) ' -- Analogy to File_Copy(what, where)
    • ZLib_ListFiles(ZipFile)
    • ZLib_AddToZipEx(ZipFile, File, Flags)
    • ZLib_FindFile(ZipFile, File)
    • ZLib_ExtractFromZip(ZipFile, OutputDir)


    I have heretic idea about ZIPFile class, which could eliminate the need to pass ZipFile as first parameter again and again.
    For OOP interface, the constructor would take optionally the parameter of ZipFile. Then the further operations would not need that:
    ZIPFile z = new ZIPFile(App_SourcePath + "my.zip")
    z.File = APP_SourcePath ' -- Changing the handled file via property, for example if I didn't pass it to the constructor
    z.AddFile(File)              ' -- the same as ZLib_AddToZip
    z.AddFile(File, Flags)     ' -- the same as ZLib_AddToZipEx
    z.ListFiles( array() ) or sBuffer = z.ListFiles()  ' -- the same as ZLib_ListFiles
    z.FindFile(File) ' -- the same asZLib_FindFile, here I am not sure what this returns?
    z.Extract(OutputDir) ' -- the same as ZLib_ExtractFromZip
    z.Extract(OutputDir, FileFromZIP) ' -- the same as ZLib_ExtractFromZip, except it will extract only specified file
    z.Extract(OutputDir, FilesFromZIP) ' -- the same as ZLib_ExtractFromZip, except it will extract only specified files in passed array
    
    You can see the OOP syntax adds lot of clarity - we manipulate ZIPFile instance, so no need to add that to name of method + the path to file is assigned once and then held.

    Petr
    Last edited by Petr Schreiber; 29-01-2012 at 19:35.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10
    My Yes for putting ZipFile as first parameter.

    My Yes for also adding a module class, but I have to think about it because zLib library is very C style oriented and not easy to transform into a class.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Similar Threads

  1. Do you know: file extensions (thinBasic)
    By ErosOlmi in forum Do you know ...
    Replies: 1
    Last Post: 28-04-2011, 11:21
  2. how to build an *.exe file with thinbasic?
    By Lionheart008 in forum Shout Box Area
    Replies: 6
    Last Post: 04-09-2008, 17:57
  3. Help us to improve thinBasic help file
    By ErosOlmi in forum Samples for help file
    Replies: 2
    Last Post: 25-05-2007, 18:16
  4. File handling in TBGL module
    By ErosOlmi in forum TBGL General
    Replies: 3
    Last Post: 22-02-2007, 00:18
  5. Thinbasic download as a zip-file possible?
    By Michael Hartlef in forum thinBasic General
    Replies: 3
    Last Post: 07-11-2006, 19:01

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •