dotnetzip

Getting a “Cannot Read That as a Zip File” Exception while trying to get a stream from an Inner Zip File (a Zip within another Zip)

穿精又带淫゛_ 提交于 2019-12-01 03:14:07
问题 In C#, I'm using the DotNetZip I have a zip called "innerZip.zip" which contains some data, and another zip called "outerZip.zip" which contains the innerZip. why am i doing it like this ? well, when setting the password, the password actually applies to individual entries that are added to the archive and not the whole archive, by using this inner/outer combo, I could set a pass to the whole inner zip because it's an entry of the outer one. Problem is, well, code speaks better than normal

Is there a way to decompress a DynaZip Max file with another library? F.E. DotNetZip

此生再无相见时 提交于 2019-12-01 02:22:11
问题 I have a database in which we stored pdf files compressed with DynaZip Max Secure, using the following code: MemoryStream msIN = new System.IO.MemoryStream(); //Input MemoryStream MemoryStream msZip = new System.IO.MemoryStream(); //Compressed MemoryStream BinaryReader objBinaryReader; BinaryWriter objBinaryWriter; public MemoryStream CompressStream(byte[] vbuf) { System.IO.BinaryWriter bw = new System.IO.BinaryWriter(msIN); bw.Write(vbuf); CDZipSNET dz1 = new CDZipSNET(); dz1

How to handle unzipping ZipFile with paths that are too long/duplicate

痞子三分冷 提交于 2019-11-30 23:47:09
问题 When unzipping files in Windows, I'll occasionally have problems with paths that are too long for Windows (but okay in the original OS that created the file). that are "duplicate" due to case-insensitivity Using DotNetZip, the ZipFile.Read(path) call will crap out whenever reading zip files with one of these problems. Which means I can't even try filtering it out. using (ZipFile zip = ZipFile.Read(path)) { ... } What is the best way to handle reading those sort of files? Updated: Example zip

Extracting a specific folder from a zip using DotNetZip

江枫思渺然 提交于 2019-11-30 15:52:59
问题 I've searched around for examples, but can't seem to find a DotNetZip scenario that involves extracting a certain folder. I'm trying to extract a folder called "CSS" from a .zip file, and it is a top-level folder inside the .zip file. This is the code I have so far: using (ZipFile zip1 = ZipFile.Read(savedFileName)) { var selection = from e in zip1.Entries where System.IO.Path.GetFileName(e.FileName).StartsWith("CSS/") select e; foreach (var e in selection) e.Extract(_contentFolder); } The

Extracting a specific folder from a zip using DotNetZip

六眼飞鱼酱① 提交于 2019-11-30 15:37:38
I've searched around for examples, but can't seem to find a DotNetZip scenario that involves extracting a certain folder. I'm trying to extract a folder called "CSS" from a .zip file, and it is a top-level folder inside the .zip file. This is the code I have so far: using (ZipFile zip1 = ZipFile.Read(savedFileName)) { var selection = from e in zip1.Entries where System.IO.Path.GetFileName(e.FileName).StartsWith("CSS/") select e; foreach (var e in selection) e.Extract(_contentFolder); } The current selection grabs nothing, and I could use some help rewriting it so it extracts the css folder and

Using ASP.NET Web API, how can a controller return a collection of streamed images compressed using DotNetZip Library?

坚强是说给别人听的谎言 提交于 2019-11-30 12:06:08
问题 How can I create a Web API controller that generates and returns a compressed zip file streamed from a collection of in-memory JPEG files (MemoryStream objects). I'm attempting to use DotNetZip Library. I found this example: http://www.4guysfromrolla.com/articles/092910-1.aspx#postadlink. But the Response.OutputStream is not available in Web API and so that technique doesn't quite work. Therefore I tried saving the zip file to a new MemoryStream; but it threw. Lastly, I tried using

Zip file is getting corrupted after uploaded to server using C#

你。 提交于 2019-11-30 07:06:24
I am trying to upload a zip file to server using C# (Framework 4) and following is my code. string ftpUrl = ConfigurationManager.AppSettings["ftpAddress"]; string ftpUsername = ConfigurationManager.AppSettings["ftpUsername"]; string ftpPassword = ConfigurationManager.AppSettings["ftpPassword"]; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpUrl + "Transactions.zip"); request.Proxy = new WebProxy(); //-----The requested FTP command is not supported when using HTTP proxy. request.Method = WebRequestMethods.Ftp.UploadFile; request.Credentials = new NetworkCredential(ftpUsername,

Ionic.Zip library unable to extract .rar file C#

牧云@^-^@ 提交于 2019-11-29 16:11:13
I am trying to extract .rar file using .net zip library (Ionic.Zip.dll). I got error " cannot read that as a zipfile " while executing following code; using (ZipFile zip1 = ZipFile.Read("E:\\APPS\\package.rar")){ } I know the error is self explanatory but documentation of Ionic.Zip says that it can be used to extract .rar files. Any ideas? Well, I not found anywhere in description that DotNetZip can extract rar files. He can extract zip created with WinRAR but nowhere notice rar file can be extracted. DotNetZip - Zip and Unzip in C#, VB, any .NET language But, there is something interesting

C# : How to report progress while creating a zip file?

☆樱花仙子☆ 提交于 2019-11-29 11:56:19
Update: Got it working updated my working code Here is what I have so far private async void ZipIt(string src, string dest) { await Task.Run(() => { using (var zipFile = new ZipFile()) { // add content to zip here zipFile.AddDirectory(src); zipFile.SaveProgress += (o, args) => { var percentage = (int)(1.0d / args.TotalBytesToTransfer * args.BytesTransferred * 100.0d); // report your progress pbCurrentFile.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new Action( delegate() { pbCurrentFile.Value = percentage; } )); }; zipFile.Save(dest); } }); } I need to figure out how

How can I delete a directory in a Zip file using .NET?

邮差的信 提交于 2019-11-29 11:32:36
How would I delete a directory in a .zip and all the files in it (preferably using DotNetZip)? Right now I'm running through all the files in the zip, but it doesn't work: foreach (ZipEntry e in zip) { //If the file is in the directory I want to delete if(e.FileName.Substring(0, 9) == "FolderName/") { zip.RemoveEntry(e.FileName); } } Is there a better way, if not, how would I make this work? First tought. Don't loop with foreach while removing elements from the collection. I will try in this way for(int x = zip.Count -1; x >= 0; x--) { ZipEntry e = zip[x]; if(e.FileName.Substring(0, 9) ==