Skip to content
This repository has been archived by the owner on Sep 20, 2018. It is now read-only.

Lzma2 - Compress Error #7

Open
rafko-sc opened this issue Nov 17, 2016 · 3 comments
Open

Lzma2 - Compress Error #7

rafko-sc opened this issue Nov 17, 2016 · 3 comments

Comments

@rafko-sc
Copy link

My code:
_zipEncode = new SevenZipCompressor(); _zipEncode.TempFolderPath = _workingDir; _zipEncode.ArchiveFormat = OutArchiveFormat.SevenZip; _zipEncode.CompressionMode = CompressionMode.Create; _zipEncode.CompressionMethod = CompressionMethod.**Lzma2**; _zipEncode.CompressionLevel = CompressionLevel.Ultra;

If I set the parameters (Lzma2) SevenZipSharp does not work.
Creates an archive file size 32 Baity and break operation.

Lzma working properly.

@chester89
Copy link
Contributor

@rafko-sc have you figured this out? What kind of exception do you see?

@rafko-sc
Copy link
Author

rafko-sc commented Jan 17, 2017

This code:

string path7z = string.Format(@"{0}\7z.dll", Environment.CurrentDirectory); // version: 16.4.0.0
SevenZipCompressor.SetLibraryPath(path7z);

_zipEncode = new SevenZipCompressor();
_zipEncode.TempFolderPath = _workingDir;
_zipEncode.ArchiveFormat = OutArchiveFormat.SevenZip;
_zipEncode.CompressionMode = CompressionMode.Create;
_zipEncode.CompressionMethod = CompressionMethod.Lzma2;
_zipEncode.CompressionLevel = CompressionLevel.Ultra;
_zipEncode.FastCompression = true;
_zipEncode.EventSynchronization = EventSynchronizationStrategy.AlwaysAsynchronous;
_zipEncode.CustomParameters.Add("mt", "on"); // Multi Threading

using (FileStream creader = new FileStream(outFile, FileMode.CreateNew))
{
_zipEncode.CompressFiles(creader, files);
creader.Close();
creader.Dispose();
}

I get this error:

image

StackTrace:

in SevenZip.SevenZipBase.ThrowException(CallbackBase handler, Exception[] e) w C:\projects\sevenzipsharp\SevenZip\Common.cs:wiersz 339\r\n w SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, CallbackBase handler) w C:\projects\sevenzipsharp\SevenZip\Common.cs:wiersz 366\r\n w SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames) w C:\projects\sevenzipsharp\SevenZip\SevenZipCompressor.cs:wiersz 1183\r\n w SevenZip.SevenZipCompressor.CompressFiles(Stream archiveStream, String[] fileFullNames) w C:\projects\sevenzipsharp\SevenZip\SevenZipCompressor.cs:wiersz 1035\r\n

@rafko-sc
Copy link
Author

Ok, problem is solved.
Must be set (for Lzma2):

_zipEncode.CompressionLevel = CompressionLevel.None;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants