dotnetzip

DotNetZip: creating zip with C# permissions issue

别等时光非礼了梦想. 提交于 2021-01-29 06:48:22
问题 I am using DotNetZip and have noticed that i am getting permission issues on Mac's. This seems to only occur when i use content disposition. ie if i just save it to disk using (ZipFile zip = new ZipFile(@"C:\zip\temp.zip")) { // this works fine } but if i use content disposition like so, on mac the user permissions are denied ( everyone group is unchecked) Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "filename=" + filename); using (ZipFile zip = new

DotNetZip how to delete a file after extracting

不羁的心 提交于 2021-01-29 06:45:17
问题 I found out a problem in my project. I'm currently using a DotNetZip library to extract zip - files. Additionally, I need to delete a zip file after extracting it's content. However, I'm unable to do it (both manually and using File.Delete(...)), cause the folder is open in my programm. So, I think this problem is caused by file extraction process The "suspicious" code part: string localFileName = @"...path...."; string remoteDir = "/SFTPfolder/"; using (var sftp = new SftpClient(SFTPHost,

I have to take the directory of a file in zip file

只愿长相守 提交于 2021-01-29 02:06:21
问题 Can someone helps me out with my problem. I have to take a file's directory in zip file so i can calculate its MD5 hash (without unzip it). I am using DotNetZip Library but i can't find the solution of the problem. I'll show you what i've tryed and hope you will help as fast as possible. Thanks! if (ofd.ShowDialog() == DialogResult.OK) { using (ZipFile zip = ZipFile.Read(ofd.FileName)) { foreach (ZipEntry f in zip) { GetMD5HashFromFile(ofd.FileName+"\\"+f.FileName); } } } 回答1: The problem is

I have to take the directory of a file in zip file

僤鯓⒐⒋嵵緔 提交于 2021-01-29 02:05:37
问题 Can someone helps me out with my problem. I have to take a file's directory in zip file so i can calculate its MD5 hash (without unzip it). I am using DotNetZip Library but i can't find the solution of the problem. I'll show you what i've tryed and hope you will help as fast as possible. Thanks! if (ofd.ShowDialog() == DialogResult.OK) { using (ZipFile zip = ZipFile.Read(ofd.FileName)) { foreach (ZipEntry f in zip) { GetMD5HashFromFile(ofd.FileName+"\\"+f.FileName); } } } 回答1: The problem is

How to unzip a split zip archive using DotNetLib

跟風遠走 提交于 2020-05-14 03:42:53
问题 I can use the DotNetZip library to unzip a single zip file: Using Zip As ZipFile = ZipFile.Read(ZipFilePath) AddMessage("Unzipping " & Zip.Entries.Count & " entries") End Using However, if I try and pass in the first segment of a split archive produced using 7-Zip (e.g. Pubs.zip.001) then it throws an error: Could not read block - no data! (position 0x03210FCE) The documentation seems to infer that you don't have to do anything special to read a split archive: This property has no effect when

Error A local variable cannot be declared in this scope

流过昼夜 提交于 2020-01-14 06:48:16
问题 I am trying to unzip a file with DotNetZip but I get a error on the "e" using (ZipFile zip = ZipFile.Read(openFileDialog1.FileName)) { foreach (ZipEntry e in zip) { e.Extract(Environment.CurrentDirectory, ExtractExistingFileAction.OverwriteSilently); } } 回答1: I suspect you are doing this inside an event handler which already has a parameter called e . Try renaming e to entry inside the foreach . 来源: https://stackoverflow.com/questions/16263099/error-a-local-variable-cannot-be-declared-in-this

Compress file with dotnetzip, and when open it is corrupted

拥有回忆 提交于 2020-01-11 09:23:29
问题 I create a zip file in a controller from a byte array and I return the zip file as a fileresult. When I download the zip File and extract the file, it is corrupt. I'm doing it this way: byte[] fileBytes =array MemoryStream fileStream = new MemoryStream(fileBytes); MemoryStream outputStream = new MemoryStream(); fileStream.Seek(0, SeekOrigin.Begin); using (ZipFile zipFile = new ZipFile()) { zipFile.AddEntry(returnFileName, fileStream); zipFile.Save(outputStream); } outputStream.Position = 0;

zip and unzip files using DotNetZip

瘦欲@ 提交于 2020-01-07 04:17:06
问题 I am using DotNetZip. Using it to zip mp3 files. ZipFile zip = new ZipFile(); zip.Password = "123"; zip.AddFile("R:\\abc\\a\\a 2 z.mp3"); zip.Save("R:\\abc\\a\\aaa.zip"); After extraction of aaa.zip, I get a corrupted mp3 file. Having 3.31MB data when original had 3.62MB. How to resolve this problem? Any help is appreciated. 回答1: The documentation states here: Be aware that the ZipFile class implements the IDisposable interface. In order for ZipFile to produce a valid zip file, you use use it

Cannot decompress ZLIB/DEFLATE data

╄→гoц情女王★ 提交于 2020-01-03 19:04:13
问题 I'm trying to extract data from compressed bytes from network capture file (PCAP.) Data from some of these packets don't have ZLIB header (the first 2 bytes, where lower 4 bits of first byte is always 8) and hence gave exception when I tried to decompress it using ZlibStream . Data with headers seem to work fine. As I understand that ZLIB is just a header and footer over DEFLATE, I pass these data without headers to DeflateStream . This time DeflateStream doesn't throw any error, it just gave

Creating a zip file in situ within azure blob storage

拟墨画扇 提交于 2020-01-03 10:23:17
问题 I have files stored in one container within a blob storage account. I need to create a zip file in a second container containing the files from the first container. I have a solution that works using a worker role and DotNetZip but because the zip file could end up being 1GB in size I am concerned that doing all the work in-process, using MemoryStream objects etc. is not the best way of doing this. My biggest concern is that of memory usage and freeing up resources given that this process