Quantcast
Channel: SevenZipSharp
Viewing all 318 articles
Browse latest View live

Reviewed: SevenZipSharp 0.64 (Mar 24, 2014)

$
0
0
Rated 3 Stars (out of 5) - In general, does the job of compressing/decompressing, but has multilple problems. Certain events are not firing as expected, it has certain performance degradation over time.

New Post: code does not work an no exception raised!

$
0
0
i am using c# and trying to 7z and encrypt a single file into a new output archive.. i succeeded to encrypt a whole folder but not a file. here is the code that does not work ( i.e. after running the code output directory has no .7z file and no exceptions raised what so ever !!) ,my archiving class look like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SevenZip;

namespace WindowsFormsApplication1
{
    class Class1
    {
        public static int compressFileTo7zip(string sourceFile, string destinationFile)
        { // takes the sourceFile and encrypt it with a password as destinationFile
            //try
            //{
            //Console.WriteLine("compressFileTo7zip source File = " + sourceFile);
            SevenZipCompressor myCompressor = new SevenZipCompressor();
            myCompressor.DirectoryStructure = true;
            myCompressor.ArchiveFormat = OutArchiveFormat.SevenZip;
            SevenZipCompressor.SetLibraryPath(@"7z.dll");

            myCompressor.CompressionMethod = CompressionMethod.Lzma;
            myCompressor.EncryptHeaders = true;
            myCompressor.IncludeEmptyDirectories = true;
            myCompressor.VolumeSize = 15000000; // 15 mb segment
            myCompressor.CompressionMode = CompressionMode.Create;
            myCompressor.TempFolderPath = System.IO.Path.GetTempPath();

            string myPassword = "2Hm3m3c2RKgkCjXyw7UGqhZh2EbezNM5EV"; // yes hardcoded ,just for debugging
            // compress with password
            myCompressor.CompressFilesEncrypted(destinationFile,myPassword, sourceFile );
            //myCompressor.CompressFiles(destinationFile, sourceFile); // no output too !!
            return 1;
            //}
            //catch (SevenZipLibraryException Ex)
            //{
            //   Console.WriteLine("7zip 2nd merror message= " + Ex.Message);
            //   return -1; // an error occured ,return an indication of that
            //}



        }
    }
}
and i call it from a button click like so :
private void button1_Click(object sender, EventArgs e)
        {
            Class1.compressFileTo7zip(@"d:\ddd.doc", @"d:\eee.7z");
        }
the file d:\ddd.doc does exist. just for the sake of completeness i will include my code that work for archiving directories:
public static int sourceDirectoryToFirstZipFile(string sourceDirectory, string destinationZip)
        {
            try
            {
                SevenZipCompressor myCompressor = new SevenZipCompressor();
                myCompressor.DirectoryStructure = true;
                myCompressor.ArchiveFormat = OutArchiveFormat.SevenZip;
                myCompressor.CompressionMethod = CompressionMethod.Lzma;
                myCompressor.EncryptHeaders = true;
                myCompressor.IncludeEmptyDirectories = true;
                SevenZipCompressor.SetLibraryPath(@"7z.dll");

                myCompressor.CompressionMode = CompressionMode.Create;
                myCompressor.TempFolderPath = System.IO.Path.GetTempPath();

                string myPassword = "j4jkds98wlef04fw8nsfvi8svd9fwemjk"; //just debugging
                // compress with password
                myCompressor.CompressDirectory(sourceDirectory, destinationZip, myPassword);
                return 1;
            }
            catch(SevenZipLibraryException Ex)
            {
                Console.WriteLine("7zip 1st merror message= " + Ex.Message);
                return -1; // an error occured ,return an indication of that
            }
        } 
shall you please give me some idea on what to do to make my code work ?
thankx

New Post: Does SevenZipSharp provide the in memory operation??

$
0
0
0down votefavorite





I've investigated SFX components used in C#, I found Sevenzipsharp.dll may be a good chooice. But there are few dobuts in the 7zip beofre I go for it. Here are my questions:
1.
Does Sevenzipsharp support in memory operating SFX .exe. For example, double click on the sfx exe, and one executable (maybe customized installer) inside the archive can be launched and operate the files in sfx exe in memory

2.
Does Sevenzipsharp support creating a big sfx exe large than 4G (due to Windows limitation, maybe it can support to spilt an big data into one sfx exe linking with multiple big volume files, so double-click on the sfx exe, the all big volume files can be operate and extract in memory)

Thanks in advance

Commented Unassigned: Compressing event not fired [12833]

$
0
0
When compressing more than one file, Compressing event is not fired

tried at least with the following:

BeginCompressFiles(string archiveName, params string[] fileFullNames);
CompressFiles(string archiveName, params string[] fileFullNames);
Comments: ** Comment from web user: bethnull **

Hi!

For me even when compressing just one file the event Compressing isn't fired. FileCompressionStarted is fired as expected.

This is the code I'm using:

```
private void Compress()
{

// some code removed (dict filling)

SevenZipCompressor compressor = new SevenZipCompressor
{
CompressionMethod = CompressionMethod.Lzma,
CompressionLevel = CompressionLevel.Normal,
CompressionMode = CompressionMode.Create,
DirectoryStructure = true,
PreserveDirectoryRoot = false,
ArchiveFormat = OutArchiveFormat.SevenZip
};

compressor.FastCompression = false;
compressor.Compressing += compressor_Compressing;
compressor.FileCompressionStarted += compressor_FileCompressionStarted;

compressor.CompressFileDictionary(dict, compress_to);
}

void compressor_Compressing(object sender, ProgressEventArgs e)
{
progress.Value = e.PercentDone;
}

void compressor_FileCompressionStarted(object sender, FileNameEventArgs e)
{
status.Text = e.FileName;
progress.Value = e.PercentDone;
}
```

Thanks in advance.

New Post: progress bar for archive checking

$
0
0
Hello,

I'm looking for a solution to implement progress bar while checking archives in vb.net.
does anyone work on this function?

thanks.

Patch Uploaded: #16476

$
0
0

SteveCarratt has uploaded a patch.

Description:
We noticed that we had problems with extracting on machines using Anti-Virus software. The issue arises from the Dispose method of StreamWrapper.

When the wrapper is disposed the base stream is closed and the anti-virus opens a handle to the file just created, but the anti-virus software opens it with only read share access. The subsequent calls below then fail because they don't have access to the file while it is in use:

File.SetLastWriteTime(_fileName, _fileTime);
File.SetLastAccessTime(_fileName, _fileTime);
File.SetCreationTime(_fileName, _fileTime);

To fix the issue we moved the block that sets the times to before we close the base stream so the anti-virus cannot open their handle until we are completely finished. To allow this to work we had to change the Create stream options on ArchiveExtractCallback: Line 359 to use FileShare.ReadWrite.

Commented Unassigned: SevenZip.SevenZipException: The execution has failed due to the bug in the SevenZipSharp [12795]

$
0
0
Hello. I keep getting the below exception from the "CompressFiles" when compressing a single binary file.

7z version: 0.64.3890.29348

code segment:
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object state)
{
try
{
szc.CompressFiles(localProcMonZipPath, localProcMonReportPath);
}
finally
{
zipComplete.Set();
}
}));

SevenZip.SevenZipException: The execution has failed due to the bug in the SevenZipSharp.
Please report about it to http://sevenzipsharp.codeplex.com/WorkItem/List.aspx, post the release number and attach the archive.
at SevenZip.SevenZipBase.ThrowException(CallbackBase handler, Exception[] e)
at SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, CallbackBase handler)
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames)
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, Int32 commonRootLength, String password, String[] fileFullNames)
at SevenZip.SevenZipCompressor.CompressFiles(String archiveName, String[] fileFullNames)
at NewYorkLauncher.NewYorkLauncher.<>c__DisplayClass11.<HandleInstaller>b__b(Object state) in c:\dev\NewYorkProject\NewYorkLauncher\NewYorkLauncher.cs:line 548
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Comments: ** Comment from web user: gbrian **

Hi, same when unzipping a file.

__7z.dll__
File version: 9.20.0.0
Product version: 9.20
Original filename: 7za.dll

__SevenZipSharp.dll__
File version: 0.64.3890.29348
Product version: 0.64.3890.29348


New Post: Archive Lock in process

$
0
0
I make a software using the SevenZipCompressor to compress a folder and in the same process I want to push the .7z.001 file to Microsoft Azure online account and I hit a error about the file is locked by a another software.

This the code I write to compress :
        SevenZipCompressor fSevenZipCompressor = new SevenZipCompressor{
                                                                           IncludeEmptyDirectories = true,
                                                                           DirectoryStructure = true,
                                                                           ArchiveFormat = OutArchiveFormat.SevenZip, 
                                                                           VolumeSize = 2147483647 // 2 * 1024 * 1024 * 1024 - 1; 2GB
                                                                       };
// ReSharper disable AccessToStaticMemberViaDerivedType : Note add suppression option because with the base class doesn't work
        SevenZipCompressor.SetLibraryPath(Application.StartupPath + (Environment.Is64BitOperatingSystem ? @"\7z64.dll" : @"\7z.dll"));
// ReSharper restore AccessToStaticMemberViaDerivedType
        fSevenZipCompressor.CompressionMode = !File.Exists(fOutputFileName) ? CompressionMode.Create : CompressionMode.Append;
        fSevenZipCompressor.ScanOnlyWritable = true;
        fSevenZipCompressor.CompressDirectory(aFolderName, fOutputFileName, true);

After when I try to make a File.OpenRead(fOuputFileName) I have a Exception :
"The process cannot access the file 'C:\Test\ZipFiles.7z.001' because it is being used by another process."
__" at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)\r\n at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)\r\n at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)\r\n at System.IO.File.OpenRead(String path)\r\n at Opto.OptoSys.Manager.Tasks.FullBackupManagerTask.UploadOnLine(String aFileName, String aOSINumber, String aDayOfTheWeek) in C:\DEV\cs\Optosys2\server\manager\src\opto\optosys\manager\tasks\FullBackupManagerTask.cs:line 172"

Created Unassigned: Generic Error when trying to compress/decompress [13113]

$
0
0
I got a generic error when trying to compress and decompress a large object using x86 compilation.

Maybe it's just an OutOfMemory error, but can't be sure because of the generic error.

I do not know if there's something we are doing wrong, but it seems that SevenZip needs too much memory to process and it's causing this error (assuming its an OutOfMemory inside SevenZipSharp or SevenZip code itself)

I've written a code to reproduce the error and it's attached to this post (Program.cs).

Please check it and say to me if we're doing anything wrong or the real exception.

Ansiously waiting for some answer.

Thanks!

Created Unassigned: SevenZipExtractor.cs _inStream.Dispose() needs null check [13148]

$
0
0
in SevenZipExtractor.cs, this relatively new code

_inStream.Dispose();

should be
if(_inStream != null) _inStream.Dispose();

It is possible somehow to get there with no _inStream (by using the constructors which take
paths?)

New Post: p7zip on Linux

$
0
0
Has anyone attempted to make SevenZipSharp work on Linux?

Reviewed: SevenZipSharp 0.64 (sept. 01, 2014)

$
0
0
Rated 1 Stars (out of 5) - I've tried it for 30 minutes it just doesn't work. Maybe a few more hours would be needed but it is not acceptable.

Created Unassigned: Problems activating Unofficial Skyrim Patch with Nexus Mod Manager [13234]

$
0
0
Nexus Mod Manager informed me, that it can not activate the Unofficial Skyrim Patch due to a bug with 7zip. I used the 7z920.exe to install 7zip and the and the Unofficial Skyrim Patch-19-2-0-6.7z to download Unofficial Skyrim Patch.

New Post: LZMA2 archive>256 MB exception/error - corrupted file

$
0
0
Hello,

i used code bellow with sevenzipsharp build from source code "sevenzipsharp-84075.zip" .
            const string 
               cFile7zdll = @"c:\Program Files (x86)\7-Zip\7z.dll",
               cDirectoryTemp = @"d:\Programy\tmp",
               cFileArchiv = @"d:\neco.7z";

            Random random = new Random();
            byte[] buffer = new byte[1024 * 1024];

            for (int file = 0; file < 257; file++) {
                using (FileStream fs = new FileStream(
                    String.Format("{0}\\file_{1:0000}.bin", cDirectoryTemp, file), FileMode.OpenOrCreate)) {
                    random.NextBytes(buffer);
                    fs.Write(buffer, 0, buffer.Length);
                    fs.Close();
                }
            }
            SevenZip.SevenZipBase.SetLibraryPath(cFile7zdll);
            var tmp = new SevenZip.SevenZipCompressor();
            tmp = new SevenZipCompressor();
            tmp.ArchiveFormat = OutArchiveFormat.SevenZip;
            tmp.CompressionMethod = CompressionMethod.Lzma2;
            tmp.CompressionLevel = CompressionLevel.Ultra;
            tmp.Compressing += (s, e) =>
            {
                Console.Clear();
                Console.WriteLine(String.Format("{0}%", e.PercentDone));
            };
            tmp.CompressDirectory(cDirectoryTemp, cFileArchiv);
After several tries I think I found a bug.
For comparing i used bat file with command
"c:\Program Files (x86)\7-Zip\7z.exe" a -m0=lzma2 -mx=9 -t7z test.7z programy\tmp"

7zip 9.20

SevenZipSharp / cause an exception
bat / cause an exception "cant allocate required memory!"

7zip 9.34 alpha

SevenZipSharp / created corrupted file without exception or error in code, with similary files sometimes will cause an exception
bat / works without problem

First view

I' am not sure, but for first look It seems it has something about paging or alocation memory.
With archive file < 256 MB it works withou problem.

Thanks for reply.

Dalibor

New Post: I can not find an example of how to create self-extract.....

$
0
0
i need to create self extract file from folder on server ASP.NET C# and I can not find an example.

i need it to be self extract file and after the user downloads the file to his computer and run the EXE file the Installation of the software starts automatically. As can be done with WINZIP and WINRAR.

Created Unassigned: Remove GC.Collect() or make it optional [13264]

$
0
0
There are two places in library where GC.Collect() is called affecting application performance.

We use SevenZipSharp in an multithreaded application that extracts and processes thousands of files (332 zip archives with 193387 text files in test run) and aggregates information on them, as a result we have quite a bit of objects in memory by the end of the run and garbage collector spend more and more time to enumerate all of them. The degradation is very significant because while garbage collector doing its job all other threads are waiting.

__Commenting out GC.Collect() altogether with GC.WaitForPendingFinalizers() reduced run time (with 6 worker threads) from more then 2 hours to less then 9 minutes!__ I didn't noticed any significant difference in memory usage by application.

Commenting out GC.AddRemoveMemoryPressure() and GC.RemoveMemoryPressure() gave another 30-45 seconds bust so run time reduced to 8 minutes.

New Post: Getting "All" File Names In An Archive

$
0
0
Hi,

How can I get all the file names inside an archive “archive1.tar.gz” when in contains additional archives?
For Example I have a main archive “archive1.zip” and it contains archive “archive2.tar.gz” and “archive3.gz" also archive “archive2.tar.gz” contains files, directory and “.tar.gz” files.
Please let me know how to read the contents of the .tar.gz and .gz file archives.

New Post: How can I get all the file names inside an archive “archive1.tar.gz” ?

$
0
0
Hi,

How can I get all the file names inside an archive “archive1.tar.gz” when in contains additional archives?
For Example I have a main archive “archive1.zip” and it contains archive “archive2.tar.gz” and “archive3.gz" also archive “archive2.tar.gz” contains files, directory and “.tar.gz” files.
Please let me know how to read the contents of the .tar.gz and .gz file archives.

Created Unassigned: How can I get all the file names inside an archive “archive1.tar.gz” when in contains additional archives? [13276]

$
0
0
Hi,

How can I get all the file names inside an archive “archive1.tar.gz” when in contains additional archives?
For Example I have a main archive “archive1.zip” and it contains archive “archive2.tar.gz” and “archive3.gz" also archive “archive2.tar.gz” contains files, directory and “.tar.gz” files.
Please let me know how to read the contents of the .tar.gz and .gz file archives.

Patch Uploaded: #16886

Viewing all 318 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>