sharpziplib

C#.net identify zip file

馋奶兔 提交于 2019-11-26 23:15:00
问题 I am currently using the SharpZip api to handle my zip file entries. It works splendid for zipping and unzipping. Though, I am having trouble identifying if a file is a zip or not. I need to know if there is a way to detect if a file stream can be decompressed. Originally I used FileStream lFileStreamIn = File.OpenRead(mSourceFile); lZipFile = new ZipFile(lFileStreamIn); ZipInputStream lZipStreamTester = new ZipInputStream(lFileStreamIn, mBufferSize);// not working lZipStreamTester.Read

Using SharpZipLib to unzip specific files?

十年热恋 提交于 2019-11-26 19:28:59
问题 I'm trying to use SharpZipLib to pull specified files from a zip archive. All of the examples I've seen always expect that you want to unzip the entire zip, and do something along the lines of: FileStream fileStreamIn = new FileStream (sourcePath, FileMode.Open, FileAccess.Read); ZipInputStream zipInStream = new ZipInputStream(fileStreamIn); ZipEntry entry; while (entry = zipInStream.GetNextEntry() != null) { // Unzip file } What I want to do is something like: ZipEntry entry = zipInStream