views:

1303

answers:

3

Hi, I´m creating a PDA app and I need to upload/download a lot of small files and my idea is to gather them in an uncompressed zip file.

The question is: It´s a good idea to read those files from the zip without separating them? How can I do so? Or is it better to unzip them? Since the files are not compressed my simple mind points that maybe reading them from the zip it´s more or less as efficient as reading them directly from the file system...

Thanks for you time!

+4  A: 

Since there are two different Open-source libraries (SharpZipLib and DotNetZip Library) to handle writing & extracting files from a zip file, why worry about doing it yourself?

James Curran
Three, actually - zlib (or the zlibce port to be specific) is also an option.
ctacke
If it wasn't a PDA app, you could even use J#: http://msdn.microsoft.com/en-us/magazine/cc164129.aspx
Marc Gravell
(i.e. the J# class libraries, accessed from C#)
Marc Gravell
A: 

Sounds as if you want to use the archive to group your files.

From a reading the files point of view, it makes very little difference if the files are handled one way or the other. You would need to implement the ability to read zip files, though. Even if you use a lib like James Curran suggested, it means additional work, which can mean additional sources of error.

From the uploading the files point of view, it makes more sense: The uploader could gather all the files needed and would have to take care of only one single upload. This reduces overhead as well as error handling (if one uplaod fails, do you have to delete all files of this group already uploaded?).

As for the efficiency of reading them from the archive vs. reading them directly from the disc: The difference should be minimal. You (or your zip library) need to once parse the zip directory structure, which is pretty straight forward. The rest is reading part of a file into memory vs. reading a file into memory.

Treb
A: 

ewww - don't use J#.

The DotNetZip library, as of v1.7, runs on the .NET Compact Framework 2.0 and above. It can handle reading or writing compressed or uncompressed files within a ZIP archive. The source distribution includes a CF example app. It's really simple.

Cheeso