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
Bookmarks