Home > Exploring the CodeFluent Runtime > CodeFluent Entities (and CodeFluent Runtime Client) Zip File support

CodeFluent Entities (and CodeFluent Runtime Client) Zip File support

The CodeFluent.Runtime.dll (provided with the CodeFluent Entities commercial product) and the CodeFluent.Runtime.Client.dll (provided as a totally FREE nuget package) both contain a very useful utility class: ZipFile.

We already talked about it in a previous post: https://blog.codefluententities.com/2012/08/24/exploring-the-codefluent-runtime-zipfile/

The big advantage of this class is it uses an unmanaged implementation of the ZIP compression algorithm. It consumes less CPU and less memory. The implementation, written in C/C++, is located in a native DLL called CodeFluent.Runtime.Compression.dll. It’s provided in 32 and 64-bit version, and both versions have the same name.

If you use the commercial CodeFluent Entities product, this 32-bit version DLL is located in the %programfiles(x86)%\SoftFluent\CodeFluent\Modeler directory, and the 64-bit version DLL is located in the %programfiles(x86)%\SoftFluent\CodeFluent\x64 directory.

If you use the Nuget package, both versions are shipped each in a x86 or x64 directory in the package.

There are few problems with this:

  1. Since the CodeFluent.Runtime.Compression.dll is a native DLL, it must be available in the standard DLL search path. The standard way of shipping it was to copy the DLL aside the .NET .exe you were developing.
  2. The problem with this is you can’t write easily a .NET .exe built as “Any CPU” that uses the ZipFile class, because both versions of the DLL have the same name. So you have to build and ship two versions (32 and 64-bit) of your .NET exe just to overcome this, and you must install them in separate directories, even if the rest of your .EXE works just fine in “Any CPU” mode…

To solve these issues, starting with CodeFluent version 760, the new ZipFile class has changed the way it finds the CodeFluent.Runtime.Compression.dll dll. The algorithm is now the following:

CodeFluent ZipFile Compression

So, existing installations should not be affected by this, however our new recommendation is:

  • If you’re writing applications that will run on machine that have the CodeFluent Entities commercial product installed (build 760 or higher), then… do nothing. The ZipFile class will find what it needs automatically.
  • If you’re writing applications that will be deployed on production machines where nothing special is installed, then don’t ship CodeFluent.Runtime.Compression.dll aside your .exe anymore but rename it as CodeFluent.Runtime.Compression.x86.dll and CodeFluent.Runtime.Compression.x64.dll and ship both aside your .exe. If you specifically compile your .exe as X86 or X64, you can put only the one required. If it’s “Any CPU”, copy both.

Happy zippin’ !

The R&D team.

  1. No comments yet.
  1. No trackbacks yet.

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