Questions tagged [sharpziplib]

#ziplib (SharpZipLib) is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.

The #ziplib (SharpZipLib) is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform. It is implemented as an assembly (installable in the GAC), and thus can easily be incorporated into other projects (in any .NET language). The creator of #ziplib put it this way: "I've ported the zip library over to C# because I needed gzip/zip compression and I didn't want to use libzip.dll or something like this. I want all in pure C#."

Reference: http://www.icsharpcode.net/opensource/sharpziplib/

Installation

SharpZipLib can most easily be installed through its NuGet package.

Install-Package SharpZipLib
272 questions
38
votes
5 answers

Using SharpZipLib to unzip specific files?

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…
FlySwat
  • 172,459
  • 74
  • 246
  • 311
23
votes
2 answers

How do I correctly prepare an 'HTTP Redirect Binding' SAML Request using C#

I need to create an SP initiated SAML 2.0 Authentication transaction using HTTP Redirect Binding method. It turns out this is quite easy. Just get the IdP URI and concatenate a single query-string param SAMLRequest. The param is an encoded block of…
biofractal
  • 18,963
  • 12
  • 70
  • 116
20
votes
6 answers

C#.net identify zip file

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…
Sean Dunford
  • 938
  • 1
  • 9
  • 24
17
votes
4 answers

Could not load file or assembly ICSharpCode.SharpZipLib... When using nuGet package ExcelDataReader

Error: Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.` Stack: [FileNotFoundException: Could…
Travis J
  • 81,153
  • 41
  • 202
  • 273
16
votes
3 answers

SharpLibZip: Add file without path

I'm using the following code, using the SharpZipLib library, to add files to a .zip file, but each file is being stored with its full path. I need to only store the file, in the 'root' of the .zip file. string[] files =…
ProfK
  • 49,207
  • 121
  • 399
  • 775
16
votes
7 answers

DLL versioning error

I've got a web site that sporadically throws the following error: Server Error in '/' Application. Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.3.365, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its…
Shaul Behr
  • 36,951
  • 69
  • 249
  • 387
15
votes
1 answer

SharpZipLib: 1 is not a supported code page

I use SharpZipLib to compress file and user got this error: 1 is not a supported code page I found here that problem is in regional settings and solution is in "replace the line of code that fetches the code page from the Thread's OEMCodePage…
Kirill
  • 429
  • 1
  • 6
  • 18
14
votes
3 answers

Add files to ZIP without paths, using SharpZipLib

I need to combine 3 files into 1 zip file and make it available to download for the user. I am able to achieve my requirement except one thing: it zips the files into the subfolders. For example, my files are located like the…
TTCG
  • 8,805
  • 31
  • 93
  • 141
14
votes
6 answers

How do I zip on the fly and stream to Response.Output in real time?

I am trying to use the following code: I get a corrupted zip file. Why? The file names seem OK. Perhaps they are not relative names, and that's the problem? private void trySharpZipLib(ArrayList filesToInclude) { // Response…
Moshe
12
votes
5 answers

ICSharpCode.SharpZipLib.Zip.FastZip not zipping files having special characters in their file names

I am using ICSharpCode.SharpZipLib.Zip.FastZip to zip files but I'm stuck on a problem: When I try to zip a file with special characters in its file name, it does not work. It works when there are no special characters in the file name.
BreakHead
  • 10,480
  • 36
  • 112
  • 165
11
votes
2 answers

How to UnZip downloaded Zip file in Xamarin forms

In my application I am getting ZIP file with 4 pdf documents during My API call. I am saving the ZIP file using the below code. var rootFolder = FileSystem.Current.LocalStorage; var file = await rootFolder.CreateFileAsync(fileName,…
StezPet
  • 2,430
  • 2
  • 27
  • 49
11
votes
2 answers

How do I implement the VirtualFileSystem required by SharpZipLib.Portable?

I would like to add the SharpZipLib.Portable library to my Xamarin.Forms PCL project. I am targeting Android and iOS. The documentation mentions that you must implement a VirtualFileSystem in order to use the library, but I do not know how to do…
Matt
  • 111
  • 1
  • 4
10
votes
1 answer

SharpZipLib create an archive with an in-memory string and download as an attachment

I use DotNetZip to create a zip archive with an in memory string and download it as an attachment with the following code. byte[] formXml = UTF8Encoding.Default.GetBytes("
Test1
"); byte[] formHtml =…
Dimuthu
  • 326
  • 2
  • 8
  • 25
9
votes
1 answer

SharpZipLib Examine and select contents of a ZIP file

I am using SharpZipLib in a project and am wondering if it is possible to use it to look inside a zip file, and if one of the files within has a data modified in a range I am searching for then to pick that file out and copy it to a new directory?…
DukeOfMarmalade
  • 2,680
  • 10
  • 41
  • 70
8
votes
2 answers

ICSharpCode.SharpZipLib validate zip file

Using ICSharpCode.SharpZipLib for C#, how can I validate that the file being passed is actually a valid zip file (not something that has been right clicked and renamed as .zip)? [HttpPost] public ActionResult Upload(HttpPostedFileBase…
GoldenUser
  • 365
  • 3
  • 6
  • 21
1
2 3
18 19