Home > Developing Using CodeFluent Entities, Exploring the CodeFluent Runtime > Exploring the CodeFluent Runtime: ZipFile

Exploring the CodeFluent Runtime: ZipFile

Since the day it was born, the CodeFluent Entities Runtime embarks a cool ZipFile class that allows you to create .ZIP files from other files, directories and streams, and extract from .ZIP files files, directories of files and streams!

The class is found in the CodeFluent.Runtime.Compression namespace and is very easy to use:

using CodeFluent.Runtime.Compression;

namespace ZipTest
    class Program
        static void Main(string[] args)
            // compress
            using (ZipFile file = new ZipFile("newzip.zip", ZipFile.Mode.Overwrite))
                file.AddDirectory(myDirectory); // recursive, keep relative paths in

            // decompress
            using (ZipFile file = new ZipFile("newzip.zip", ZipFile.Mode.Read))
                file.GetFiles(myOutputDirectory); // recursive, keep relative paths out

For CPU performance and memory usage reasons, and contrary to other popular .NET zip implementations (http://www.icsharpcode.net/opensource/sharpziplib/, or http://dotnetzip.codeplex.com/), CodeFluent Entities’ ZipFile implementation is unmanaged.

It means you will have to copy a native Windows DLL (that is shipped with the product) named “CodeFluent.Runtime.Compression.dll” in the bin directory of your application for this to work. Since it’s unmanaged, there are two versions of this dll, one for X86 processes, and another for X64 processes.

It’s fun to see Microsoft has finally taken the same unmanaged route for ZIP handling, this year, in 2012, as we did 7 years ago, when we shipped our first version of CodeFluent Entities 🙂

The CodeFluent Runtime is available in two flavors:

Happy zip-ing!

The R&D team.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s