class with exeption handling

Aug 5, 2011 at 4:32 PM

Hello,

in the meanwhile I have worked a little with the great DotNetZip library, but now I need to write a class to handle all operations with zip archives. What I want is a class who give back an error status, also the class must handle all errors. Within the own class I plan to have a property like "IsOk" or "IsError" if an error occured by opening the archives or reading entries and files.

In my constructor "new (ByVal ...)  I set the filename, than I check if the file is an archive (with IsZipFile), but when the archive is corrupt or one of the files are corrupted, so I need as result an error-message or error-number.

The tool runs without a GUI and it is not possible to stop the work, only to skip the archive. In this case I will write an entry in a logfile and go to the next archive.

Have anyone written a class and can give me any tips?

Best regards,
Maximilian

Coordinator
Aug 5, 2011 at 7:06 PM

Good luck with your project.

You should first have a look at the ZipFile.CheckZip methods.  and the ZipFile.IsZipFile() methods.

Aug 6, 2011 at 12:00 AM

Hi Cheeso,

thanks for the both links, but I know the functions. What I mean / need is a replay after open assigned file with ...zipfile.read(filename)... like -1 = not opened or 1 = opened or is the function IsZipFile enough to go sure that te archive is ready to read?

Regards,
Daniel

PS:
My Project is running, but I would like to increase the stability

Coordinator
Aug 6, 2011 at 2:27 AM

Hmmm, I don't know what it means "replay after open assigned file" .  But anyway I Was only making a suggestion.

Good luck.