Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, March 29, 2018 8:53 PM
Hi everyone,
how can i test the file if it is still correct and not damaged.
without decompressing the zip file
All replies (2)
Friday, March 30, 2018 2:13 PM
The general approach to determining whether a file has been modified is an MD5 checksum. You calculate the checksum on a known, good file. Then you rerun the check when you want to verify it is still not modified.
However, unless you have a corrupt file system or something, once you write a file out to disk it isn't going to change unless another app changes it. So are you trying to detect a change in a file while your app is running or you simply want to verify someone hasn't modified the file after you?
Michael Taylor http://www.michaeltaylorp3.net
Friday, March 30, 2018 10:44 PM
how can i test the file if it is still correct and not damaged.
without decompressing the zip file
I assume you want to test the integrity of the ZIP file, such as using
"Test" in 7-Zip or "Test Archive" using Total Commander or -t with pkzip.
I don't recall seeing that capability in the .NET classes which handle
ZIP files. You may need to use a 3rd-party library such as SharpZipLib.
Note the TestArchive method on this page:
https://icsharpcode.github.io/SharpZipLib/help/api/ICSharpCode.SharpZipLib.Zip.ZipFile.html
Also see:
ICSharpCode.SharpZipLib validate zip file
https://stackoverflow.com/questions/9539730/icsharpcode-sharpziplib-validate-zip-file
https://icsharpcode.github.io/SharpZipLib/
https://github.com/icsharpcode/SharpZipLib/releases
http://community.sharpdevelop.net/forums/12.aspx
- Wayne