dotnetzip

Creating a zip file in situ within azure blob storage

情到浓时终转凉″ 提交于 2020-01-03 10:21:44
问题 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

Extracting zip file in memory failing with C# DotNetZip

两盒软妹~` 提交于 2020-01-02 06:48:29
问题 I'm trying to download and extract a zip file in C#, specifically DotNetZip. When I run this code... HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(reportUrl); HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse(); Stream stream = response.GetResponseStream(); MemoryStream ms = new MemoryStream(); stream.CopyTo(ms); ms.Seek(0, 0); ZipInputStream zip = new ZipInputStream(ms); zip.Seek(0, 0); ZipEntry e = zip.GetNextEntry(); string s = e.FileName; MemoryStream ms2

Extracting zip file in memory failing with C# DotNetZip

感情迁移 提交于 2020-01-02 06:48:04
问题 I'm trying to download and extract a zip file in C#, specifically DotNetZip. When I run this code... HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(reportUrl); HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse(); Stream stream = response.GetResponseStream(); MemoryStream ms = new MemoryStream(); stream.CopyTo(ms); ms.Seek(0, 0); ZipInputStream zip = new ZipInputStream(ms); zip.Seek(0, 0); ZipEntry e = zip.GetNextEntry(); string s = e.FileName; MemoryStream ms2

How to check whether file exists in zip file using dotnetzip

笑着哭i 提交于 2019-12-30 09:34:25
问题 I am creating zip using dotnetzip library. But I don't know how to check if a file exists in the zip. If the file exists then I will update the file with path. public void makezip(string flname) { string fln =flname; string curFile = @"d:\crs.zip"; if (File.Exists(curFile)) { ZipFile zipfl = ZipFile.Read(@"D:\crs.zip"); var result = zipfl.Any(entry => entry.FileName.EndsWith(@fln)); if (result == true) { zipfl.UpdateFile(@fln); }else{ zipfl.AddFile(@fln); } zipfl.Save(@"d:\crs.zip"); } else {

DotNetZip download works in one site, not another

耗尽温柔 提交于 2019-12-25 05:32:26
问题 EDIT - RESOLVED: the difference was that in the "main" case the download was initiated via a callback cycle, and in the "test" case it was initiated through a server side button click function. My guess is that the download request and the callback cycle interfered with each other, both stopping the download and causing the page to become inactive (as described below). When I rewired the download on the main page to start with a submit instead of a callback, it did initiate the download. This

Reduce file size with DotNetZip

ぃ、小莉子 提交于 2019-12-25 04:32:33
问题 I want to backup my database using SMO and zip a backup file then upload it to my server. here is my code // Backup var conn = new SqlConnection(sqlConnectionString); var server = new Server(new ServerConnection(conn)); var backupMgr = new Backup(); backupMgr.Devices.AddDevice(file.FullName, DeviceType.File); backupMgr.Database = dictionary[StringKeys.Database]; backupMgr.Action = BackupActionType.Database; backupMgr.SqlBackup(server); // Compress using (var zip = new ZipFile()) { zipFile =

DotNetZip How to fix 0000000 CRC32 issue?

戏子无情 提交于 2019-12-25 02:42:20
问题 I'm using DotNetZip to add multiple MemoryStreams to a single archive. So far, my code works when I select 1 or 2 files, but does not work if I add more. I found the difference is the CRC32 are all 00000000 for those bad archive. Is it something about the archive size? Any help is appreciated! My code in C#: foreach(.....){ var zipEntryName=.....//Get the file name in string; var UDocument = .....//Get a object var UStream = UDocument .GetStream(); UStream.Seek(0, SeekOrigin.Begin); ZipEntry

Split zip file using DotNetZip Library

烂漫一生 提交于 2019-12-24 01:47:06
问题 I'm using DotNetZip Library to create a zip file with about 100MB.I'm saving the zip file directly to the Response.OutputStream Response.Clear(); // no buffering - allows large zip files to download as they are zipped Response.BufferOutput = false; String ReadmeText= "Dynamic content for a readme file...\n" + DateTime.Now.ToString("G"); string archiveName= String.Format("archive-{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss")); Response.ContentType = "application/zip"; Response

unzip password protected file

一笑奈何 提交于 2019-12-23 13:03:45
问题 how to unzip a password protected file using dotnetzip or sharpziplib (if the password is not known). 回答1: GPL-3 zip password-cracking code: http://oldhome.schmorp.de/marc/fcrackzip.html Using the Ubuntu-supplied packages, it took my machine 19 seconds to crack the password of the supplied sample .zip file (as described in the README). 回答2: Passwords in the zip file format are applied to the compressed file entry data. This means that there is not a single password for a zip file. There are N

Add Folders to Root of Zip Using Ionic Zip Library

二次信任 提交于 2019-12-23 09:10:03
问题 what I'm trying to do is add a list of folders and files all to the root of my Zip file, using the Ionic Zip library (c#). Here's what I have so far string k = "B:/My Documents/Workspace"; private void button1_Click(object sender, EventArgs e) { using (ZipFile zip = new ZipFile()) { //add directory, give it a name zip.AddDirectory(k); zip.Save("t.zip"); } } Now, I want my zip to be looking like this. t.zip Random Files and Folder But it's looking like this. t.zip t (folder) Random files and