views:

316

answers:

3
+1  Q: 

c# file container

Hello!

I am searching for a way to add several files into one file, much like a Zip file. I need to be able to create a file container on the fly and add several word documents, images and other important files into the container. My criteria is that you don't need to install any additional software on the computer (preferebly only a .DLL file that i can include in my project), that the program is free and that you can encrypt the data.

Anyone know of any good container programs that has support for these 2 criterias or if anyone know any good information about how to create your own container.

Patrick

+4  A: 

Does it have to be like a zip file, or can it be a zip file?

Are you using .NET Framework 3.0 or 3.5? If so, look at System.IO.Packaging.ZipPackage

This discussion has a section about it.

In addition to DotNetZip (licensed with Microsoft Public License) that Jay Riggs mentions, there's SharpZipLib (licensed with GPL). Whichever you choose, be sure the terms of the license match your understanding of the word "free".

If you can use ZipPackage, one benefit is that you don't need to think about license terms (beyond those of developing any other .NET app).

EDIT: DotNetZip and SharpZipLib support encryption. I don't see that ZipPackage does, but you could look at System.IO.Packaging.EncryptedPackageEnvelope.

JeffH
It can be a ZIP file aslong as it can be integrated into my project (DLL-file or similar) and that it supports encryption.
Patrick
A: 

User .Net GZipStream class(System.IO.Compression namespace.) to compress and decompress files. You can find more information on

  1. MSDN Link

  2. GZIP Compression

I have personally used this technique to decomress .zip file. Click Here

Neil
+2  A: 

I used DotNetZip in a project and it worked really well. I would recommend using it. It supports encryption and is easy to use.

http://www.codeplex.com/DotNetZip

corymathews