Free Support Forum - aspose.com

Does the ZIP.dll supports reading/decompressing rar file?

Hi, support:

I want to know whether the zip.dll supports reading/decompressing rar file? if so, which version the api support it?
I try the zip.dll(v21.3), it report not to support reading/decompressing rar file.
And supporting to read/decompress Rar file may be concerned in the future version for zip.dll?

@ducaisoft

Yes, Aspose.ZIP for .NET allows to extract RAR4 single-volume archives. Please read the following article.

Thanks for your instruction.
I try :
Dim RARArchive As RarArchive = New RarArchive(Path & “\Test.rar”)
RARArchive.ExtractToDirectory(Path, “”)
RARArchive.Entries(0).Extract(Paht & “\Test.doc”, “”)
It works.

However, I want to Extract an single Entry (whose file size may be greater than 100Mb) with unzip progress info, how to do it?
And more, how to add a file (whose file size may be greater than 100Mb) into zip Archive with zip progress info?

I do not find the mothed to support this.

And more, how to rename/delete a file entry or a folder entry?

And how to create an zip archive with password?

and how to check whether a zip archive or rar archive has password protected?
if a zip/rar archive has password protected, and if a password is specified, how to validate whether the password is valid.

@ducaisoft

Could you please share some more detail about this requirement? Please share the detail of RAR file and ZIP files in it.

Please read the following articles. Regarding ‘progress info’, Aspose.ZIP does not provide any interface or progress bar.

Please read : Modifying ZIP File

Please read : How to ZIP files with password in C#

We have logged your requirement as ZIPNET-664 in our issue tracking system. You will be notified via this forum thread once there is any update available on it. We apologize for your inconvenience.

Thanks for your attention to my query.
And another query is that updating/refreshing a file in rar archive is expecting in future version.

@ducaisoft

We have logged this feature request as ZIPNET-667 in our issue tracking system. You will be notified via this forum thread once it is resolved. We apologize for your inconvenience.

Another Bug report:

If a rar archive is compressed by RAR4 with filename containing Chinese characters, please see the demo pic( 123.png (29.5 KB)
) which displays correctly like this.

Whereas this rar archive is read by Aspose.zip.dll, the Chinese characters in filename are displayed in mess-up codes (222.png (6.5 KB)
). Please fix it!

@ducaisoft

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input ZIP files.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Please refer to this demo application.
LXGroup.zip (2.5 MB)

@ducaisoft

We have logged this problem in our issue tracking system as ZIPNET-668. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@ducaisoft

Aspose.ZIP supports opening of password-protected RAR5 archives since 20.9 release:

Creation of RAR5 archives is not allowed by RAR format license.

ArchiveEntry.CompressionProgressed event raises when a portion of raw stream compressed and ArchiveEntry.ExtractionProgressed event raises when a portion of raw stream extracted. Please check the following code examples. Hope this helps you.

//Compression progress event
using (var archive = new Archive(new ArchiveEntrySettings()))
{
    archive.CreateEntry("entry.bin", source);
    int percentReady = 0;
    archive.Entries[0].CompressionProgressed += (s, e) =>
    {
        int percent = (int)((100 * (long)e.ProceededBytes) / source.Length);
        if (percent > percentReady)
        {
            Console.WriteLine(string.Format("{0}% compressed", percent));
            percentReady = percent;
        }
    };
    archive.Save(zipFile);
}
//Extracton progress event
using (Archive archive = new Archive(...))
{
    int percentReady = 0;
    archive.Entries[0].ExtractionProgressed += (s, e) =>
    {
        int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize);
        if (percent > percentReady)
        {
            Console.WriteLine(string.Format("{0}% decompressed", percent));
            percentReady = percent;
        }
    };
}

Aspose.ZIP cannot be used to create or alter RAR archive. Updating/refreshing a file in RAR archive is never expected. Please see point 10 of RAR license. So, we have closed ZIPNET-667

You can figure out if ZIP entry is encrypted casting it to ArchiveEntryEncrypted. The issue ZIPNET-664 has been closed.

There is no way to verify the validity of password apart from trying to decompress.

Thanks for your demo.
But I fail to convert the demo into VB.net code based on zip.dll v21.4 because there is no ExtractionProgressed and CompressionProgressed.
Would you please provide me a full VB.net demo version on how to compress/decompress a archive with progress information?

@ducaisoft

We are working over this query and will get back to you soon.

@ducaisoft

Please use following VB.NET code example to implement ArchiveEntry.ExtractionProgressed event. Hope this helps you.

Dim archive As New Archive("c:\temp\input.zip")
AddHandler archive.Entries(0).ExtractionProgressed, AddressOf extractionProgressed
archive.ExtractToDirectory("C:\temp\out\") 
Sub extractionProgressed(s As ArchiveEntry, e As ProgressEventArgs)
    Dim percentReady As Integer = 0

    Dim percent As Integer = CInt(100 * e.ProceededBytes / CType(s, ArchiveEntry).UncompressedSize)
    If percent > percentReady Then
        Console.WriteLine(String.Format("{0}% decompressed", percent))
        percentReady = percent
    End If
End Sub

Thank you very much.
That do for me.
But, Why there is no RarArchive.Entries(0).ExtractionProgressed?

@ducaisoft

Please check the attached image. The ExtractionProgressed is event of ArchiveEntry class.
image.png (165.8 KB)

Thanks for your reply.
But, I’m afraid you may misunderstand my question, please refer to the following code:

    Dim RARArchive As RarArchive = New RarArchive("C:\Temp\out\Freshmen.rar")
    AddHandler RARArchive.Entries(0).extractionProgressed, AddressOf extractionProgressed

It reports extractionProgressed is not a member of RARArchive class, that is to say, RARArchiveEntry does not support extractionProgressed.
Therefore, how to compress/decompress rararchive with progress info?

@ducaisoft

We have logged your requirement in our issue tracking system as ZIPNET-674. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks.

And another request is whether the zip.dll api support getting the Thumbnail of Entry whose type is image?
if so,how to get its Thumbnail?

@ducaisoft

Please ZIP and attach your input ZIP file along with expected output. We will then provide you more information about your query.