dotnetzip

unable to get multiple entries in SelectEntries of DotNetZip

前提是你 提交于 2019-12-11 18:32:01
问题 I'm trying to use DotNetZipLib-DevKit-v1.9 in my MVC3 Project to extract the files to a specific folder. What i want is -- How to add multiple entries in zip.SelectEntries method. Here is my code in controller action: public ActionResult ExtractZip(string fileName, HttpPostedFileBase fileData) { string zipToUnpack = @"C:\Users\Public\Pictures\Sample Pictures\images.zip"; string unpackDirectory = System.IO.Path.GetTempPath(); using (ZipFile zip1 = ZipFile.Read(zipToUnpack)) { // here, we

DotNetZip zipping files with Arabic names

我怕爱的太早我们不能终老 提交于 2019-12-11 16:14:47
问题 When creating a zip file out of many Arabic named files, I have as prompted in DotNetZip's FAQ changed the code page to the following: Using zip As New ZipFile() zip.AddDirectoryByName("Files") zip.AlternateEncoding = Encoding.UTF8 zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always Dim row As Integer For row = 0 To ds.Tables("d").Rows.Count - 1 fileToDownload = Server.MapPath("~/.../Resources/Attachments/" + ds.Tables("d").Rows(row).Item(1).ToString) zip.AddFile(fileToDownload, "Files")

Is it possible to create a self-extracting archive which will run a specific file when unzipped?

大城市里の小女人 提交于 2019-12-11 03:48:26
问题 For example, I want to put a deployment of an application which includes setup.exe into a self-extracting archive. When the user executes the self-extracting archive it'll unzip the contents to a temp folder and run setup.exe. Is this possible? If so, any examples? 回答1: yes, that's one of the things you can do with DotNetZip . The doc page provides an example. SaveSelfExtractor Method (exeToGenerate, options) string DirectoryPath = "c:\\Documents\\Project7"; using (ZipFile zip = new ZipFile()

DotNetZip - Calculate final zip size before calling Save(stream)

青春壹個敷衍的年華 提交于 2019-12-10 22:23:53
问题 When using DotNetZip, is it possible to get what the final zip file size will be before calling Save(stream)? I have a website where users will be downloading fairly large zip files (over 2 gigs), and I would like to be able to stream the file to the user rather then buffering the entire file into memory. Some thing like this... response.BufferOutput = false; response.AddHeader("Content-Length", ????); Is this possible? 回答1: If the stream is homogenous, you could waste some time by

Convert DotNetZip ZipFile to byte array

送分小仙女□ 提交于 2019-12-10 16:27:17
问题 I've built a DotNetZip ZipFile with several entries. I'd like to convert it to a byte array so I can download it using the download construct below. Using wrkZip As New ZipFile '----- create zip, add memory stream---------- For n As Integer = 0 To wrkAr.Count - 1 wrkFS = wrkAr(n) wrkZip.AddEntry(wrkFS.FileName, wrkFS.ContentStream) Next dim wrkBytes() as Byte dim wrkFileName as string = "Test.txt" ===> wrkBytes = ConvertToByteArray(wrkZip) <==== context.Response.Clear() context.Response

Compression fails when using ionic zip

纵然是瞬间 提交于 2019-12-09 15:55:50
问题 I am using the latest version of ionic zip version 1.9.1.8.I have set the property of ionic zip ParallelDeflateThreshold = 0 . The zipping mechanism was working perfectly for the past two months.Suddenly this stopped working.The zipping thread just hangs,ionic zip just created the tmp file and failed to create the zip file. I could easily reproduce this issue even with small file size. My analysis for this issue is as follows The issue was with the latest version of ionic zip, in this case

Ionic Zip : Zip file creation from byte[]

狂风中的少年 提交于 2019-12-09 10:08:41
问题 Ionic zip allows me to add existing file to zip object and create a zip file. But considering that I am reading those byte[] from created zip file and sending over server, I need to again create zip file from that byte[] to store zip on server. How do I achieve this ? I am using C#. 回答1: If I understand your question correctly, you get your byte[] data array over the network and want to save that data in a zip file? You can create a new ZipEntry from a MemoryStream which you create from the

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

江枫思渺然 提交于 2019-12-08 23:13:27
问题 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

How to Use DotNetZip to extract XML file from zip

给你一囗甜甜゛ 提交于 2019-12-08 19:58:54
问题 I'm using the latest version of DotNetZip, and I have a zip file with 5 XMLs on it. I want to open the zip, read the XML files and set a String with the value of the XML. How can I do this? Code: //thats my old way of doing it.But I needed the path, now I want to read from the memory string xfile = System.IO.File.ReadAllText(strNewFilePath, System.Text.Encoding.Default); using (ZipFile zip = ZipFile.Read(this.uplZip.PostedFile.InputStream)) { foreach (ZipEntry theEntry in zip) { //What should

Sending Zip file to Client via Response with DotNetZip

冷暖自知 提交于 2019-12-07 16:52:02
问题 this is my code private void sendToClient(Dictionary<string, string> reportDic) { Response.Clear(); Response.BufferOutput = false; String ReadmeText = "some text"; Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "filename=" + "filename.zip"); using (ZipFile zip = new ZipFile()) { zip.AddEntry("Readme.txt", ReadmeText); zip.Save(Response.OutputStream); } Response.Close(); } at this point I'm simply trying to return a zip file with the readme.txt document