Creating a multi-volume archive failed

Jun 30, 2011 at 10:27 AM

Hi folks.

I've tried to create a multi-volume archive using the sevenZipSharp.dll (version 0.64) and the following code:

public bool PackFiles(string ArchiveFile, string tempDir, bool appendToArchive, int volumeSize, params string[] files)
        {
            #region Check parameters

            if (files == null || files.Length <= 0)
            {
                throw new ArgumentNullException("files");
            }

            if (String.IsNullOrEmpty(ArchiveFile))
            {
                throw new ArgumentNullException("ArchiveFile");
            }

            #endregion

            try
            {
                SevenZipCompressor.SetLibraryPath(SearchLibraryPath());
                SevenZipCompressor zipCompressor = new SevenZipCompressor();

                zipCompressor.ArchiveFormat = OutArchiveFormat.SevenZip;
                zipCompressor.CompressionLevel = CompressionLevel.High;

                // Append only, if archive already exist
                if (appendToArchive)
                {
                    zipCompressor.CompressionMode = (File.Exists(ArchiveFile) ? CompressionMode.Append : CompressionMode.Create);
                }
                else
                {
                    zipCompressor.CompressionMode = CompressionMode.Create;
                }

                if (!string.IsNullOrEmpty(tempDir))
                {
                    zipCompressor.TempFolderPath = tempDir;
                }

                if (volumeSize > 0)
                {
                    zipCompressor.VolumeSize = volumeSize;
                }

                zipCompressor.CompressFiles(ArchiveFile, files);

                return true;
            }
            catch
            {
                return false;
            }
        }

But when I set the "VolumeSize" property nothing happens. The "CompressFiles" function returns immediately. Without setting this property the function works fine.

I've tried to use other archive formats and other compression levels but nothing happens. Did I anything wrong or is this a bug?

Thanks for the help!

Sep 1, 2011 at 11:02 PM

I have exactly the same problem :

you can't use theCompressFiles méthod with volumesize > 0. Only CompressDirectory. Bug fix ya ?

++
Joris

Dec 15, 2011 at 10:49 AM

Just encountered the same problem.

To fix this bug, compile SevenZipSharp with the following change:

File: SevenZipCompressor.cs

Line: 1098

Original: if (fs == null)

Fixed: if (fs == null && _volumeSize == 0)


Cheers, piiper

May 25, 2012 at 8:48 PM

Thank you, thank you.

May 29, 2012 at 6:09 PM

I am not able to open the solution - getting an error - csproj cannot be opened because its project type is not supported by this version of the application

Can someone send me the dll with the VolumeSize fix please?

 

monahan7_7@hotmail.com - thank you.