Creating Zip archives in .NET (without an external library like SharpZipLib) - Jon Galloway

Creating Zip archives in .NET (without an external library like SharpZipLib)

Overview

SharpZipLib provides best free .NET compression library, but what if you can't use it due to the GPL license? I'll look at a few options, ending with my favorite - System.IO.Packaging.

SharpZipLib is good, but there's that GPL thing

SharpZipLib includes good support for zip. I've written about it a few times, and I think it's great. Unfortunately, it's under a wacky "GPL but pretty much LGPL" license - it's GPL, but includes a clause that exempts you from the "viral" effects of the GPL:

Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module.

Bottom line In plain English this means you can use this library in commercial closed-source applications.

I'm pretty sure that the reason for this odd "sort-of-GPL" license is because some of the SharpZipLib is based on some GPL's Java code. However, most companies have policies which forbid or greatly restrict their use of GPL code, and for very good reason: GPL has been set up as an alternative to traditional commercial software licensing, and while it's possible to use GPL code in commercial software, it's something that requires legal department involvement. So, my bottom line is that I can't use your code due to your license.

.NET Zip Library

UPDATE: DotNetZip has been released on CodePlex, and the one issue I ran into has been fixed. I'd recommend giving this a try instead of System.IO.Packaging (as I'd originally recommended), because it's a lot easier to use.

The Zip format allows for several different compression methods, but the most common is Deflate. System.IO.Compression includes a DeflateStream class. You'd think that System.IO would include Zip, but... no. The problem is that, while System.IO.DeflateStream can write to a stream, it doesn't write the file headers required for Zip handlers to read them.

Microsoft Interop blog posted a .NET Zip Library which adds the correct headers to the output of a System.IO.Compression DeflateStream.

ZipFile zip= new ZipFile("MyNewZip.zip");
zip.AddDirectory(
"My Pictures", true); // AddDirectory recurses subdirectories
zip.Save();

Note: DotNetZip has been released to CodePlex, and the issue I reported has been fixed. 

This works, but with some caveats. First of all, adding files causes an identical structure to be created in the zip. For instance, if I use the following:

zip.AddFile("C:\My Documents\Sample\File.txt");

The resulting Zip will contain File.txt, but it will be within the \My Documents\Sample\ hierarchy. There's no way to control the structure of the zip file when you add individual files, unless you want to modify the zip library (which is under MsPL license). That proved to be a big problem in my case, because the zip structure I'm creating is pretty rigid. So, if you're just zipping an entire folder full of files, this library may work for you, but if you need more control you may need to modify the library. I'm guessing if this were published on CodePlex it would have been fixed a while ago.

Another larger problem to keep in mind is that stream based compression is much less efficient than file based compression. File compression can optimize the compression used based on the content of all included files; stream based compression compresses data as it comes in, so it can't take advantage of data it hasn't seen yet.

The J# Zip Library

J# has included zip since day one, to keep compatible with the Java libraries. So, if you're willing to bundle the appropriate Java library (specifically, vjslib.dll), you can use the zip classes in java.util.zip. It works, but it seems like a really goofy hack to distribute a 3.6 MB DLL just to support zip.

System.IO.Packaging includes Zip support

In .NET 3.0, you can use the the System.IO.Packaging  ZipPackage class in WindowsBase.DLL. It's just 1.1 MB, and it just seems to fit a lot better than importing Java libraries. It's not very straightforward, but it does work. The "not straightforward" part comes from the fact that this isn't a generic Zip implementation, it's a packaging library for formats like XPS that happen to use Zip.

First, you'll need to find WindowsBase.dll so you can add a reference to it. If it's not on your .NET references, you'll probably find it in C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll.

It's not as simple as it should be, but it does work. Here's a sample that creates a Zip archive and adds two files:

 

using System;
using System.IO;
using System.IO.Packaging;

namespace ZipSample
{
class Program
{
static void Main(string[] args)
{
AddFileToZip(
"Output.zip", @"C:\Windows\Notepad.exe");
AddFileToZip(
"Output.zip", @"C:\Windows\System32\Calc.exe");
}

private const long BUFFER_SIZE = 4096;

private static void AddFileToZip(string zipFilename, string fileToAdd)
{
using (Package zip = System.IO.Packaging.Package.Open(zipFilename, FileMode.OpenOrCreate))
{
string destFilename = ".\\" + Path.GetFileName(fileToAdd);
Uri uri
= PackUriHelper.CreatePartUri(new Uri(destFilename, UriKind.Relative));
if (zip.PartExists(uri))
{
zip.DeletePart(uri);
}
PackagePart part
= zip.CreatePart(uri, "",CompressionOption.Normal);
using (FileStream fileStream = new FileStream(fileToAdd, FileMode.Open, FileAccess.Read))
{
using (Stream dest = part.GetStream())
{
CopyStream(fileStream, dest);
}
}
}
}

private static void CopyStream(System.IO.FileStream inputStream, System.IO.Stream outputStream)
{
long bufferSize = inputStream.Length < BUFFER_SIZE ? inputStream.Length : BUFFER_SIZE;
byte[] buffer = new byte[bufferSize];
int bytesRead = 0;
long bytesWritten = 0;
while ((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) != 0)
{
outputStream.Write(buffer,
0, bytesRead);
bytesWritten
+= bufferSize;
}
}
}
}

 

Zip

One weird side-effect of using the ZipPackage to create Zips is that Packages contain a content type manifest named "[Content_Types].xml". If you create a ZipPackage, it will automatically include "[Content_Types].xml"., and if you try to read from a ZIP file which doesn't contain a file called "[Content_Types].xml" in the root, it will fail.

You'll notice that the compression in my test is not that great. In fact, pretty bad - Notepad.exe got bigger. Binary files don't compress nearly as well as text-based files - for example, I tested on a 55KB file and it compressed to less than 1KB - but the compression in this library doesn't appear to be fully implemented yet. For example, the CompressionOption enum includes CompressionOption.Maximum, but that setting is ignored. Normal is the best you'll get right now.

Another possible reason for low compression ratios in this sample is that I'm adding files separately rather than adding several files at a time. As I mentioned earlier, Zip compression works better when it has access to the entire file or group of files when creating the archive.

You can use the packaging library for your own file format. For example, here's an example that stores object state using XmlWriters to write to a Zip stream.

But where's System.IO.Zip?

That's a good question. All the Zip handling in System.IO.Packaging is in an internal class MS.Internal.IO.Zip. It would have been a lot more useful to implement a public System.IO.Zip which was used by System.IO.Packaging so that we could directly create and access Zip files without pretending we were creating XPS packages with manifests and Uri's.

Published Thursday, October 25, 2007 1:07 AM by Jon Galloway

Comments

# Creating Zip Archives In .Net Without An External Library

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Thursday, October 25, 2007 10:31 AM by DotNetKicks.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Jon, if you think a CodePlex project would be in order for the Zip library, I am happy to launch it.  

Let me know.

Thursday, October 25, 2007 11:12 AM by Dino

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I cannot believe it has taken until .net 3.0 for this to have been added.  You have to wonder that if you end up having to write wrappers around this just to make using the objects easier that people will just stick with SharpZipLib "'cause it works"

Thursday, October 25, 2007 12:04 PM by Dave

# hostedhg &raquo; Creating Zip archives in .NET (without an external library like &#8230;

Pingback from  hostedhg &raquo; Creating Zip archives in .NET (without an external library like &#8230;

# Zip Archives in .NET at Justin Wendlandt

Pingback from  Zip Archives in .NET  at  Justin Wendlandt

Thursday, October 25, 2007 2:50 PM by Zip Archives in .NET at Justin Wendlandt

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

If I'm not mistaken the initial (.NET 1.1 and .NET 2.0) available compression libraries from System.IO.Compression is not based on the Zip algorithm, but rather, on the GZip standard. Hence the problems with compatibility in deflation.

Friday, October 26, 2007 1:09 AM by Jon Limjap

# Links of the (Yester)day, 4

Links of the (Yester)day, 4

Friday, October 26, 2007 3:00 PM by PhilloPuntoIt

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I can't believe the basis for this whole article is the author's terrible understanding of the GPL. I don't write GPL software, but I've certainly incorporated both modified and unmodified GPL components in several .NET applications that I've deployed within the authoring organization (i.e., NOT for resale outside the organization). If you aren't redistributing GPL components outside your organization, you don't have to honor the GPL. It's a *distribution* license, not an EULA! If you are planning to redistribute outside your org, the GPL kicks in and you need to honor the license. About sharpziplib, you wrote:

"I'm pretty sure that the reason for this odd "sort-of-GPL" license is because some of the SharpZipLib is based on some GPL's Java code."

This claim is baseless, and serves only to intentionally FUD sharpziplib. The actual terms of the license--which you quote and then completely contradict--is eminently agreeable, with no need to involve the legal department. Further, you wrote:

"...most companies have policies which forbid or greatly restrict their use of GPL code, and for very good reason: GPL has been set up as an alternative to traditional commercial software licensing, and while it's possible to use GPL code in commercial software, it's something that requires legal department involvement."

What the hell is "commercial software" in the context of these ramblings? To me, commercial software is something I want to sell to other people. Dealing with GPL code in my product isn't different than any other license I might have to honor for 3rd-party components I seek to resell, all of which I WANT MY LAWYER TO LOOK AT.

These solutions don't make a lot of sense if your goal is actually COMPRESS DATA, and seem more about not paying money than dealing with compression in a sensible way. Why not suggest licensing a 3rd party compression framework? What's the real motivation here?

Saturday, October 27, 2007 4:55 AM by Good luck

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

@Anonymous "Good luck" ranter -

I've posted a few times about SharpZipLib, including some working code samples. I've also put in a lot of work in support of Mono, by co-founding the Monoppix Linux Live CD project.

Yes, there are good external libraries (GPL, products like Xceed, etc.), and we're both happy to use them when appropriate.

If your goal is to compress data for code you're not going to distribute, the title of the post should tell you that you've come to the wrong place. This post is about creating zip archives without external libraries.

There are times when you want to distribute your application without someone else dictating your license, and that doesn't just include selling them. I'm sure that you've encountered this when you were selecting your license in your projects on CodePlex, SourceForge, Google Code, etc., right?

Your FUD comment is silly rhetoric - it's a fact that SharpZipLib is under GPL, and I was speculating on why that might be. I can't conceive of how that speculation could cause frear, uncertainty, or doubt - the fact is that it's under GPL.

Saturday, October 27, 2007 1:01 PM by Jon Galloway

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

@Jon Limjap:

Some clarifications (my ex-coworkers at Xceed know I hate when people mix compression algorithm and archive format):

- DEFLATE is a compression algorithm, which transforms data X to data Y without adding any headers or footers (other than checksums and markers to help decompress)

- GZip is an archive format, made of a header, compressed data and a footer. The header contains a field that tells what compression algorithm was used. It happens that it's ALWAYS deflate.

- Zip is another (better) archive format, also made of headers, compressed data, footers et al. The header also contains a field that tell what is the compression method. It happens that Deflate is the most popular and supported, though better compression algorithms exist.

- .NET 1.1 did not have compression

- .NET 2.0 has the DeflateStream, which compresses data using the Deflate algorithm, but does not add a header or footer.

- .NET 2.0 also has the GZipStream, which uses the DeflateStream underneath, and also creates a header and footer.

So it's not a question of compatibility of a GZip compression versus Zip compression. These FORMATS both use the SAME deflate compression, but different header/footer formats. In short, if .NET 2.0 did not have a ZipStream or equivalent, the ONLY reason is that it wasn't a priority for MS (or they think Xceed Zip is too awesome q;-) )

Saturday, October 27, 2007 2:24 PM by Martin Plante

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Great post! I was writing the same post last week but yours is way better! Thanks for doing the homework.

Sunday, October 28, 2007 3:45 AM by Scott Hanselman

# Code-Inside Blog &raquo; W&ouml;chentliche Rundablage: .NET 3.5, ToJson, Zippen, WPF Tutorials&#8230;

Pingback from  Code-Inside Blog  &raquo; W&ouml;chentliche Rundablage: .NET 3.5, ToJson, Zippen, WPF Tutorials&#8230;

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

The DotNetZip library is now a CodePlex project.  

www.codeplex.com/DotNetZip

Wednesday, October 31, 2007 1:14 AM by Dino

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

The 1.2 release of the DotNetZip library on codeplex addresses the first concern you raised, Jon, which is that

"There's no way to control the structure of the zip file when you add individual files"

There's now a way to control the structure of the directory path with each additional file or directory you add to the archive.

www.codeplex.com/.../ProjectReleases.aspx

Friday, November 02, 2007 1:19 PM by Dino

# Kompresja ZIP &amp; DeflateStream &laquo; .NET i takie tam

Pingback from  Kompresja ZIP &amp; DeflateStream &laquo; .NET i takie tam

Friday, November 02, 2007 6:52 PM by Kompresja ZIP & DeflateStream « .NET i takie tam

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Please read my article:

www.codeproject.com/.../ZipStorer.asp

Tuesday, November 27, 2007 2:11 AM by Jaime

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

What about if you use the .Net framework 2

Thursday, December 20, 2007 5:48 AM by Werner

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I tried using DotNetZip but unfortunately it just doesn't currently have enough options. For example, it doesn't support password-protecting the file and also doesn't stream the compressed contents to disk until it is done. In my case, I'm trying to programmatically compress and encrypt  multi-gigabyte database backups but DotNetZip's limitations currently don't work for me.

I do hope though that the creators of DotNetZip continue to develop it because all the other options are just not ideal.

Friday, January 25, 2008 8:40 PM by Ken McNamee

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

How can one unzip programmatically with the "WindowsBase.dll" file?

Monday, January 28, 2008 3:50 PM by Mark Kamoski

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

The zip is OK and works. Nice. However, if one unzips the created zip file (using >Windows XP Pro, >Windows Explorer, >Right click, >Extract All), then one will note that it puts all the files into 1 output directory. That is, the folder stucture is not preserved in any way. Is there a way to preserve the folder structure?

Monday, January 28, 2008 4:46 PM by Mark Kamoski

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

BTW, I could not agree more about the GPL. Furthermore, as a contractor, my clients have consistently felt the same way-- it goes too far. What is particularly disingenuous about the GPL is that they tag it as somehow "free", (as in "Free Software Foundation"), when, in fact, it is just a set of rules about what one can do, cannot do, and must do. That's not "free" at all. As Wikipedia notes "In order to preserve the freedom to use, study, modify, and redistribute free software, most free software licences carry requirements and restrictions which apply to distributors. There exists an ongoing debate within the free software community regarding the fine line between restrictions which preserve freedom and those which reduce it." Furthermore, just to spill a little more gasoline on it, this "copy left" idea, which states "that when modified versions of free software are distributed, they must be distributed under the same terms as the original software" is another joke. Let's face facts here. "Free software" is something with "NO STRINGS ATTACHED AT ALL". Period. That's about as clear as it gets. Oh well, back to topic, thanks for the article. I see the unzip stuff is here... msdn2.microsoft.com/.../ms771414(VS.85).aspx ...so that is great.

Tuesday, February 05, 2008 5:48 AM by Mark Kamoski

# sharpziplib windows compressed files

Pingback from  sharpziplib windows compressed files

Friday, May 02, 2008 11:41 PM by sharpziplib windows compressed files

# &raquo; Effexor side effects. A Side: What The World Is Saying About A Side

Pingback from  &raquo; Effexor side effects. A Side: What The World Is Saying About A Side

# &raquo; ?? Effexor side effects. A Side: What The World Is Saying About A A Side: What The World Is Saying About A Side

Pingback from  &raquo; ?? Effexor side effects. A Side: What The World Is Saying About A A Side: What The World Is Saying About A Side

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I ended up doing this trick with J# myself.  Seeing those java namespaces in my C# was peanut butter in my chocolate.

<a href="www.codepraxis.com/.../a>

Wednesday, July 16, 2008 11:24 PM by Derek

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I really do not understand your point of view on the GPL modified license "problem" with SharpZipLib... What is the issue when distributing commercial products that use SharZipLib considering this license terms exception ???

Moreover, what is the difference between your library and SharpZilLib... I mean : what do you mean with "without an external library" ? Your code is distributed as source archive or assembly, just as SharpZipLib, did I miss something ?

I think a new shared library is always good news but your article seems a little odds to me...

Friday, September 12, 2008 7:45 AM by Alex

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

thanks for your time in researching this article. i have been looking for a solution.

I agree about the code sample you show. i think the code complexity of most actions in  dotnet is fine for the guy writing it, but when a stranger somes back to maintain it, the problems arise. time is money.

Friday, May 01, 2009 11:03 AM by dave

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

GREAT!!!!! Thanks :)

Thursday, May 14, 2009 5:28 AM by larav

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Create a directory inside the ZIP using your method.

private static void AddFileToZip(string zipFilename, string fileToAdd, string Directory)        {            using (Package zip = System.IO.Packaging.Package.Open(zipFilename, FileMode.OpenOrCreate))            {                string destFilename = ".\\" + sDirectory + "\\" + Path.GetFileName(fileToAdd);                Uri uri = PackUriHelper.CreatePartUri(new Uri(destFilename, UriKind.Relative));                if (zip.PartExists(uri))                {                    zip.DeletePart(uri);                }                PackagePart part = zip.CreatePart(uri, "",CompressionOption.Normal);                using (FileStream fileStream = new FileStream(fileToAdd, FileMode.Open, FileAccess.Read))                {                    using (Stream dest = part.GetStream())                    {                        CopyStream(fileStream, dest);                    }                }            }        }

Friday, May 15, 2009 1:16 PM by Al Pascual

# Creating a folder inside the ZIP file with System.IO.Packaging - Al Pascual ASP.NET Blog

Pingback from  Creating a folder inside the ZIP file with System.IO.Packaging - Al Pascual ASP.NET Blog

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Hi all,

I have just released a new version of ZipStorer with Deflate support at: zipstorer.codeplex.com

Thursday, July 30, 2009 11:01 PM by Jaime Olivares

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

dsfgsdfg dfssdfgf fdsgsdfgsd

Saturday, August 01, 2009 3:09 PM by sabsSleette

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Hello! I'am have some trouble. I want create ZIP package with RUSSIAN files, and before creating archive i have bad-russian. How insert russian string in ZIP?

Friday, August 14, 2009 9:27 AM by shwed

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Very easy.  Thank you.

Monday, August 24, 2009 8:01 PM by Nathan

# 文件传输(一)---压缩文件

异构系统之间的交互有很多种方式,AX的AIF框架通过文件,WebServices和MSMQ等提供了实现各种交互方式的可能性,井底之蛙的缘故,总觉得这些方式有些隔靴搔痒的感觉,做为AX来说,它不可能针...

Wednesday, November 18, 2009 4:53 AM by 佛西亚

# Creating Zip archives in .NET (without an external library like SharpZipLib) &#8211; Jon Galloway

Pingback from  Creating Zip archives in .NET (without an external library like SharpZipLib) &#8211; Jon Galloway

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I am very appriciate you. But the problem is, how can we avoid for generating [content-type].xml file. My client is not required this file. Please let me know to fix this.

Friday, March 12, 2010 5:38 AM by Chitti Chaitanya

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

You can also go to <a href="www.openzipfile.com/">open zip file</a> to open your zip files easily online. Hope this is a big help.

Monday, May 31, 2010 4:15 AM by Tonya Henson

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Hello!, as you mentioned, the library automatically adds a xml file ([Content_Types].xml) and if you read the zip file without that file, it does't work. But if I don't want that xml file in my zip, is there any way to remove it?

Tuesday, June 08, 2010 2:20 PM by Carlos

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

jon, great post... how did you solve the folder structure when adding files in a zip file using DotNetZip lib?

thanks!

Wednesday, August 04, 2010 10:15 PM by Rex

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Разные люди ищут надежные фирмы, которые предлагают такие услуги как: [url=www.bustrans.com.ua/.../6]прокат микроавтобусов[/url]. И действительно, перевозки пассажиров становяться ужасно популярными среди разных людей, так как это очень дешево.

Thursday, October 07, 2010 8:35 AM by MihailBurov21

# How to Create a Zip File ASP NET

Pingback from  How to Create a Zip File ASP NET

Thursday, February 17, 2011 9:06 AM by How to Create a Zip File ASP NET

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

How to Unzip the file

Wednesday, March 02, 2011 1:55 AM by Fardin

# Criar um ficheiro Zip em C#

Uma forma r&aacute;pida de criarmos um ficheiro Zip, &eacute; recorrendo &agrave; classe ZipPackage do

Friday, March 04, 2011 4:05 AM by Tiago Salgado

# Criar um ficheiro Zip em C# | oito ...

Pingback from  Criar um ficheiro Zip em C# | oito ...

Friday, March 04, 2011 4:05 AM by Criar um ficheiro Zip em C# | oito ...

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I have used System.IO.Packaging - ZipPackage class in WindowsBase.DLL, but for some of the download its giving the error Cannot access the closed Stream. When i check the zip file few files are added to the zip and not all.

Tuesday, April 05, 2011 1:44 AM by Hiren

# ASP.NET - VB.NET How to compress a file on server and make a ZIP file of it

Pingback from  ASP.NET - VB.NET How to compress a file on server and make a ZIP file of it

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I just wasted a day trying to use this approach to read and write zip files. The author fails to mention some of the major gotchas you'll likely encounter using these poorly designed .NET classes.

First, the file names in the archive will be URL encoded! "My Stuff.txt" will be saved in the archive as "My%20Stuff.txt".

Next, the Package.Open(stream,...) methods are ridiculously restrictive on what type of FileStream they'll accept. I wasted hours before learning that it will NOT accept a FileStream that was created via File.Open, no matter what FileMode, FileAccess options I used when opening it. Create a FileStream using "new" instead.

Finally, the deal breaker: reading a zip file! The author provided no example of this. Calling Package.Open() on existing file succeeds, but calling GetParts() simply returns an empty array. Microsoft's example of reading a package relies on package relationships being established. I'm not sure its even possible to create the file created in the example above using the ZipPackage class.

Tuesday, April 05, 2011 3:07 PM by Bruce

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Thanks Bruce, after reading your comment I only had to waste half a day. Does anybody have another suggestion for reading zip-files?

Monday, April 11, 2011 9:51 AM by Vilhelm

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Buy cheap TomTom maps of Australia 8.55.2884 Oem Software Version

Buy cheap Adobe Illustrator CS5 Oem Software Version

Buy cheap Foxit Corp Foxit Reader 3.3.1 Oem Software Version

Buy cheap Accessory Software Data Quik 6 Oem Software Version

Buy cheap Abbey Road TG 12413 Limiter 2.0.1 Oem Software Version

<a href="fugajowl.blog.com online Merge Professional 2008 3626 in Santa Clara</a>

Wednesday, April 20, 2011 8:49 PM by alorioulajala

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Buy cheap 4Videosoft DVD to Creative Zen Converter 3.2.10 Oem Software Version

Buy cheap ElcomSoft Advanced Sage Password Recovery 2.40 Oem Software Version

Buy cheap Lynda Creating a CSS Style Guide  Oem Software Version

Buy cheap Rosetta Stone Ltd Spain 3 Levels 3.2 Oem Software Version

Buy cheap 4Videosoft WMV Video Converter 3.2.06 Oem Software Version

<a href="siyilisp.blog.com cheap DFMPro For Solidworks SP1 2.1.250 in Gainesville</a>

Thursday, April 21, 2011 8:48 AM by alorioulajala

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

In file name it is not accepting "#" so how can I change that..

Please suggest...

Friday, August 26, 2011 8:58 AM by Dev

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I want to convert folder to zip with dll in c#.net

Friday, November 04, 2011 5:31 AM by sandeep

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Lol! I really like this!

Friday, January 20, 2012 10:30 AM by Oscillmiche

# Using System.IO.Packaging - nonocast

Pingback from  Using System.IO.Packaging - nonocast

Friday, January 27, 2012 2:22 PM by Using System.IO.Packaging - nonocast

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

For Descomprime Zip

with code this:

       private static void ExtractFileToZip(string zipFilename)

       {

           using (System.IO.Packaging.Package zip = System.IO.Packaging.Package.Open(zipFilename, System.IO.FileMode.Open))

           {  

               System.IO.Packaging.PackagePartCollection  parts = zip.GetParts();

               foreach (System.IO.Packaging.PackagePart part in parts)

               {

                   String Archivo=part.Uri.ToString ().Replace(@"/",@"\");

                   String StrRutaArchivo = Environment.CurrentDirectory + Archivo;

                  using (System.IO.FileStream fileStream = new System.IO.FileStream(StrRutaArchivo, System.IO.FileMode.CreateNew,System.IO.FileAccess.ReadWrite))

                   {

                       using (System.IO.Stream Origen = part.GetStream())

                       {

                           long bufferSize = Origen.Length < BUFFER_SIZE ? Origen.Length : BUFFER_SIZE;

                           byte[] buffer = new byte[bufferSize];

                           int bytesRead = 0; long bytesWritten = 0;

                           while ((bytesRead = Origen.Read(buffer, 0, buffer.Length)) != 0)

                           {

                               fileStream.Write(buffer, 0, bytesRead);

                               bytesWritten += bufferSize;

                           }

                       }  

                   }  

               }

           }

       }

Thursday, February 02, 2012 11:26 AM by santiago Solis

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Does anyone know if the System.IO.Packaging method still creates a [content_types].xml file inside the zip? I can't have any unwanted file(s) in my zip because of automation purposes.

Monday, March 26, 2012 2:00 PM by TimFromDallas

# friday links 25 &laquo; A Programmer with Microsoft tools

Pingback from  friday links 25 &laquo; A Programmer with Microsoft tools

Friday, April 13, 2012 12:04 AM by friday links 25 « A Programmer with Microsoft tools

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

For female, the particular Marbella sandal throughout patent household leather is actually a hot and stylish preference. It's in honor towards the 70's types of preceding a long time, nonetheless is usually suitable for summer use. Your fantastic stiletto features a gorgeous monogrammed rose like a sign of luxurious. We have an internal software in addition to a padding throughout <a href=www.cheap-lvsale.com/>louise vuitton bags</a> with regard to added comfort.

Wednesday, July 11, 2012 2:36 PM by Elishalit

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

ERYERADFGASDGASDGHASD  FGBNFSDGSADADFHGAD

ADFHGZSDGASDDSFGHADS  ERYERSDGSADXZCBZX

FGBNFSDGSADADSFHGADFS  GJTRSDGSADASDGHASD

ZVXZSDGSADDFHAD  YUKYZSDGASDDSFGHADS

Monday, August 27, 2012 7:13 AM by reriAcroria

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

QWERSDGSADDSFGHADS  ASFDADFGASDGSDGASD

ZVXZSDGSADSDAFHSAD  FGBNFADFHGDAFADSFHGADFS

GJTRADFHGDAFSDGASD  ASFDSDGSADXZCBZX

YUYSDGSADSDAFHSAD  YUYADFHGDAFADFHGAD

Friday, August 31, 2012 4:19 PM by chuslyurgerse

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

FGBNFSDGSADDSFGHADS  SDGSDADFHGDAFASDFHGAD

GJTRSDGSADADFHGAD FGBNFADFHGDAFSDAFHSAD

ERYERADFHGDAFDSFGHADS ERYERSDGSADGADFHAD

SDGSDSDGSADADFHAD ASFDADFGASDGSDFH

Tuesday, September 04, 2012 6:38 PM by GafeWrofe

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

ZVXZASDGASDADFHAD  YUYADFGASDGSDFH

DSGAADFGASDGDSFGHADS  DSGASDGSADASDFHGAD

GJTRSDGSADGDFHAD  QWERADFHGDAFADSFHGADFS

SDGSDSDGSADDSFGHADS  SDGSDADFHGDAFDFHAD

Wednesday, September 05, 2012 1:14 PM by Zesemensush

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

ERYERSDGSADXZCBZX  SDGSDASDGASDASDGHASD

YUKYASDGASDDFHAD  FGBNFSDGSADASDGHASD

ADFHGSDGSADGDSFGHADS  ASFDZSDGASDDFHAD

YUYADFGASDGADSFHGADFS  ERYERZSDGASDDFHAD

Wednesday, September 05, 2012 6:36 PM by Absordreibe

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

ERYERSDGSADASDGHASD  YUKYSDGSADSDGASD

QWERSDGSADSDFH  GJTRSDGSADXZCBZX

ERYERADFGASDGSDGASD  ERYERADFHGDAFSDFH

DSGAZSDGASDSDAFHSAD  YUYZSDGASDSDFH

Thursday, September 20, 2012 6:18 AM by Blawlnard

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Heya i’m for the first time here. I came across this board and I find It truly useful &

it helped me out a lot. I hope to give something back and

help others like you helped me.

Wednesday, October 17, 2012 11:45 AM by Grayson

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Do you have a spam issue on this site; I also am a blogger, and I was wondering your situation; many of us have developed some nice practices and we are looking to swap methods with others, why not shoot me an email if interested.

Saturday, November 03, 2012 3:05 PM by izazebhfbe@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Howdy are using Wordpress for your site platform? I'm new to the blog world but I'm trying to get started and set up my own. Do you require any html coding expertise to make your own blog? Any help would be really appreciated!

Tuesday, November 13, 2012 12:08 AM by suhxjgteo@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I dreaded night after night of at least 10 minutes just trying to get the Product off. ,<a href=macmakeup01.weebly.com makeup</a>

Sunday, December 16, 2012 7:56 PM by oakssfiliy

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Dunno if this has been mentioned but if you're online, you can go to <a href="www.openzipfile.com/">open zip file</a> to open zip files. It's super easy and hope that helps someone!

Tuesday, December 18, 2012 2:13 PM by Melissa Courter

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

If you're not exactly sure if you have been infected with the herpes virus, it is wise to see a medical professional as soon as possible.

Tuesday, December 18, 2012 2:18 PM by Scott Koch

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Melasma is a very common affliction and can be addressed by using a quality skin lightening cream and moisturizer as directed.

Tuesday, December 18, 2012 2:29 PM by Skin Whitening

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Its like you read my mind! You appear to know a lot about this, like you wrote

the book in it or something. I think that you can do with a few pics to

drive the message home a little bit, but instead of that, this is excellent blog.

A fantastic read. I'll definitely be back.

Saturday, January 05, 2013 6:01 AM by Villagomez

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

You can find a brand new invention that everyone who smokes should learn about. It's called the electronic cigarette, also called a smokeless cigarette or <a href=www.blogger.com/.../01642240203628745106>where to buy electronic cigarette </a> , and it is actually changing the authorized landscape for cigarette people who smoke round the planet.

The patented Electronic cigarette gives you to efficiently simulate the experience of smoking cigarettes an actual cigarette, without the need of any of your health or lawful issues surrounding regular cigarettes.

While Electric cigarettes seem, come to feel and taste much like regular cigarettes, they functionality pretty differently. You see, e-cigs never actually burn any tobacco, but fairly, when you inhale from an e-cigarette, you activate a "flow censor" which releases a h2o vapor containing nicotine, propylene glycol, along with a scent that simulates the flavour of tobacco. All of which simply ensures that e-cigs assist you to get your nicotine deal with while staying away from the entire cancer leading to brokers uncovered in classic cigarettes like as tar, glue, countless additives, and hydrocarbons.

Moreover to becoming much healthier than regular cigarettes, and perhaps most significantly of all, could be the proven fact that e cigs are entirely legal. For the reason that Electric cigarettes do not contain tobacco, you may lawfully smoke them anywhere that common cigarettes are prohibited these types of as bars, dining places, the function place, even on airplanes. In addition, e-cigarettes permit you to smoke without fears of inflicting hurt on many others because of to horrible 2nd hand smoke.

The refillable cartridges can be found in a mess of flavors in addition to nicotine strengths. You can get frequent, menthol, even apple and strawberry flavored cartridges and nicotine strengths can be found in entire, medium, light, and none. Even though e cigs are technically a "smoking alternative" alternatively than the usual smoking cigarettes cessation system, the variety of nicotine strengths delivers some evident possibilities being an aid while in the kinds attempts to stop smoking cigarettes and appears to be being proving well-known inside of that sector.

The great point about electric cigarettes as apposed to convey, nicotine patches, is the fact e-cigarettes generate the identical tactile sensation and oral fixation that smokers wish, while satisfying kinds tobacco cravings too. Any time you require a drag from n ecigarette you actually sense the your lungs fill that has a heat tobacco flavored smoke and once you exhale the smoke billows away from your lungs just like frequent using tobacco, on the other hand, as mentioned, that smoke is in fact a much healthier drinking water vapor that promptly evaporates and as a consequence doesn't offend any person in the instant vicinity.

When e cigs have already been approximately for some time in various incarnations, it's been modern improvements during the technologies as well as at any time escalating limits in opposition to using tobacco that have propelled the e-cigarette into a new located recognition. In case you are interested in a more healthy different to cigarette smoking, or should you simply want to hold the independence to smoke where ever and anytime you would like, an e-cigarette could be the solution you've got been trying to find.

Sunday, January 20, 2013 7:42 PM by Heelolfquable

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Excelente!!

Super!!

Muchas gracias!

Sunday, January 20, 2013 11:16 PM by John J. Martinez

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

helped so much. The best advise I can give you is PRIMER PRIMER PRIMER. If you apply a ,fakeoakleysunglasses.jigsy.com

Friday, January 25, 2013 8:01 AM by cifgsarudn

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

t get too much direct heat during the cooking process.

The grill unfortunately is a risky place to cook meals, and also the griddle can be a great

present towards the wellbeing aware. Add the water a teaspoon at a

time so it's not over done.

Friday, February 08, 2013 5:01 AM by Metcalf

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I such as the important data you produce with your article content.I will bookmark your blog and investigate all over again the following recurrently.I am pretty confident I will gain knowledge of a great deal of recent things correct the following! Very good luck with the subsequent!

Sunday, February 17, 2013 1:48 AM by yqmkqqqr@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

After 5 minutes, turn the pizza 180 degrees to insure even cooking.

You might need to dust your rolling pin with flour too, if the crust sticks to it too much while you are rolling.

Add the water a teaspoon at a time so it's not over done.

Friday, February 22, 2013 6:21 AM by Littleton

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

My family members always say that I am wasting my time here

at web, but I know I am getting experience everyday by reading

thes nice articles.

Wednesday, March 06, 2013 10:54 PM by Mcmullin

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

<a href="louisvuittoncpursesonlineoutlet.webs.com/">cheap louis vuitton outlet</a> cheap louis vuitton handbags outlet

Monday, March 11, 2013 10:34 AM by yicilk@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I'd prefer to uslysht a little a lot more on this subject

Tuesday, March 12, 2013 7:53 AM by mtfcked@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

This is a attention-grabbing article by the way. I am going to go ahead and bookmark this post for my brother to check out later on tonight. Keep up the excellent work. gucci 財布 http://www.guccisaihujp.com/

Thursday, March 14, 2013 9:09 AM by lvobbej@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Have a look at the ZipFile class in .Net Framework 4.5, if that's an option.

msdn.microsoft.com/.../ms404280(v=vs.110).aspx

Thursday, March 21, 2013 12:15 PM by Johan Karlsson

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

He especially enjoys one that is loaded with veggies.

The Big Green Egg can also be used as a slow smoker. You should have

a persistence of cooling of the pizza stone.

Saturday, March 23, 2013 12:12 AM by Tilton

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

After 5 minutes, turn the pizza 180 degrees to insure even cooking.

Cook the chicken first in a little olive oil - cut the chicken

into little cubes. It didn't help that every pizza recipe I saw online would mention the dreaded "bread machine.

Saturday, March 23, 2013 2:55 AM by Hutson

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

I’m not that much of a online reader to be honest but your

blogs really nice, keep it up! I'll go ahead and bookmark your website to come back down the road. Many thanks

Saturday, April 06, 2013 4:49 PM by Cintron

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Quality content is the main to be a focus for the visitors to visit the web site,

that's what this web page is providing.

Wednesday, April 17, 2013 1:52 AM by Blackmon

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Today, while I was at work, my sister stole my iPad and tested to

see if it can survive a 40 foot drop, just so she can be a youtube sensation.

My iPad is now destroyed and she has 83 views. I know this is

completely off topic but I had to share it with someone!

Wednesday, May 01, 2013 1:49 AM by Hollis

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Otherwise known as Chocolate Town, Hershey also provides the opportunity to get up

close and private with Santa and the reindeer while enjoying

various Christmas themed rides and activities. Very carefully lay

the sticky aspect up on the other aspect in the decal that we haven accomplished something with

to this stage and grab your scissors. Imran Khan, while seeing off

the convoy of 10 trucks carrying seeds, announced that a scheme was launched to deliver wheat seeds to each province without any discrimination

for flood-hit farmers owning 25 acres of land.

Thursday, May 02, 2013 4:09 PM by Ponder

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

These exercises aren't included in sort pattern of movements. So the sensitive information supposed to have to protect from access by others.

Thursday, May 09, 2013 4:03 PM by Yarborough

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Hey! This is my first visit to your blog! We are a group of volunteers and starting

a new initiative in a community in the same niche. Your blog provided us valuable

information to work on. You have done a wonderful job!

Friday, May 10, 2013 9:18 PM by Shively

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

This really is precisely what I had been searching for, thank you

Saturday, May 11, 2013 2:10 PM by vpyklegj@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Another ensemble in red, white and blue incorporates a

swing dress using a matching cardigan in red and blue with white buttons.

Kate Dillon was born just outside of Washington, DC a bit over thirty

years ago but she grew up in San Diego, the land of perpetual slim.

Online broke this news early this morning on March 7.

Saturday, May 11, 2013 4:52 PM by Battles

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

i really like your post and will read your blog

Saturday, May 11, 2013 9:49 PM by zbqhwdvmi@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

kjklsaljsagkljglkkjlkasjlkgj

_________________

<a href=http://www.baidu.com>baidu</a>

Monday, May 13, 2013 1:54 AM by DusDuefswaT

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Great website. Lots of useful info here. I’m sending it to a few friends ans also sharing in delicious. And of course, thanks for your sweat!

Tuesday, May 14, 2013 11:48 PM by geypeebi@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Falling merely a couple of lbs weekly can certainly make botanical slimming soft gel strong version pretty obvious creates a limited stretch of time. Fast weight loss has not been your intelligent selection in regards to reducing weight; for that reason an operation may possibly botanical slimming soft gel strong version possess a spectacular outcome on our bodies and may even cause you to be develop into sick and tired because of some sort of poor nutrition.

Sunday, May 19, 2013 12:23 AM by kojwbwez@aol.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

guide of venture the wayLooking for madness of well known? inspect all these help and information for the classifications behind traditional organization view

Monday, May 20, 2013 7:02 AM by katewandce@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Since 1961, the Homeland music.Association has gone honoring the very best

in country music. Insane Clown Posse hails from Detroit, which

is not one of these methods.

Monday, May 20, 2013 10:31 PM by Mcdonnell

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

allow players to maintain state extended occupation career  http://www.baidu.com into your best opportunities to finding ideal sunglasses to meet

Tuesday, May 21, 2013 4:34 AM by Andreavpk

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Creating Zip archives in .NET (without an external library like SharpZipLib) - Jon Galloway juivcnl  mulberry www.diving-tenerife.co.uk

Wednesday, May 22, 2013 7:25 AM by wctgdqoxr@gmail.com

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

Another critical aspect to check out is the employees work schedules.

The main difference of an employee and also contractor centers close by autonomy and cope with.

Wednesday, May 22, 2013 9:43 AM by Christie

# re: Creating Zip archives in .NET (without an external library like SharpZipLib)

This software can be introduced to computers via the Internet.

Ultimate keylogger has a unique capability to capture both sides of a coin, this program

has its dark side too. Monitor does not involve a steep learning curve, does not require eyecandy, and Soft

Activity obviously realizes this. Passwords using ardamax Keylogger.

Anytime, there are still some clues that can help you to narrow your choices.

10 to $25 The price for credit card information. With computer spy monitor software helps you to find

out what their online activity could be crucial.

Wednesday, May 22, 2013 11:29 AM by Staples

Leave a Comment

(required) 
(required) 
(optional)
(required)