How to get the name of a part when the volume changes (Multi-Volume) #282

Open
opened 2026-01-29 22:09:30 +00:00 by claunia · 4 comments
Owner

Originally created by @Headkillah on GitHub (Mar 12, 2018).

Is it possible to get the part-name of an entry while extracting it?

For example: I have a Multi-Volume with 20 parts (.rar - .r19)

I start the extracting and i need the name of the volume-part when the volume changes... Is this possible?

Hope that nobody blames me for this question, but i don´t have much knowledge with C#

Originally created by @Headkillah on GitHub (Mar 12, 2018). Is it possible to get the part-name of an entry while extracting it? For example: I have a Multi-Volume with 20 parts (.rar - .r19) I start the extracting and i need the name of the volume-part when the volume changes... Is this possible? Hope that nobody blames me for this question, but i don´t have much knowledge with C#
claunia added the enhancementup for grabs labels 2026-01-29 22:09:30 +00:00
Author
Owner

@adamhathcock commented on GitHub (Mar 13, 2018):

This would probably require the Reader to have knowledge of the current volume. It probably already does. Just need to expose it like CurrentEntry

Pull requests are welcome

@adamhathcock commented on GitHub (Mar 13, 2018): This would probably require the Reader to have knowledge of the current volume. It probably already does. Just need to expose it like `CurrentEntry` Pull requests are welcome
Author
Owner

@Headkillah commented on GitHub (Mar 13, 2018):

Thx for the help adam, i solved my problem :) After you give me a hint, i found here on github the fix for my problem.

I´m using the IArchive Interface and FilePartExtractionBeginEventArgs. And a little change in "FileInfoRarFilePart.cs". I´ve changed the part "return FileInfo.FullName" to "return FileInfo.Name" and removed the "File entry" thing :) For me it works PERFECT now .

@Headkillah commented on GitHub (Mar 13, 2018): Thx for the help adam, i solved my problem :) After you give me a hint, i found here on github the fix for my problem. I´m using the IArchive Interface and FilePartExtractionBeginEventArgs. And a little change in "FileInfoRarFilePart.cs". I´ve changed the part "return FileInfo.FullName" to "return FileInfo.Name" and removed the "File entry" thing :) For me it works PERFECT now .
Author
Owner

@CrownParkComputing commented on GitHub (Mar 29, 2018):

Can u post the link to your solution as I think this will help with my progress issue

@CrownParkComputing commented on GitHub (Mar 29, 2018): Can u post the link to your solution as I think this will help with my progress issue
Author
Owner

@Headkillah commented on GitHub (Mar 29, 2018):

ATM i have no link, put i can you post here a part of my solution. For me, it works very good. Don´t know if do this for you, too....

In "SharpCompress.Archives.Rar.FileInfoRarFilePart.cs" change it in this manner:

internal override string FilePartName
    {
        get
        {
            return FileInfo.Name;
            //return "Rar File: " + FileInfo.FullName
            //       + " File Entry: " + FileHeader.FileName;
        }
    }

The Rest i´ve done is made with vb.net, so you have to convert it to c#. And this is only a little part of the solution... And a little bit old code, because i´m not at home :D

This is the important thing... In my project Label11 is the Label wich shows the actual volume (e.g. "test.r08")

Private Sub archive_FilePartExtractionBegin(ByVal sender As Object, ByVal e As FilePartExtractionBeginEventArgs)
    Label11.Text = e.Name
End Sub

Private Sub PrintVolumes(ByVal ArchivePath As String)

    Using archive As IArchive = getIArchive(ArchivePath, Nothing)

        AddHandler archive.FilePartExtractionBegin, AddressOf archive_FilePartExtractionBegin

            For Each entry As IArchiveEntry In archive.Entries

                If Not entry.IsDirectory Then

                    Label3.Text = entry.Key
                    Label5.Text = entry.CompressedSize.ToString
                    Label7.Text = entry.Size.ToString
                    Label9.Text = archive.Volumes.Count.ToString

                    entry.WriteToDirectory(dest, Nothing)

                End If
            Next
        End If
    End Using
End Sub
@Headkillah commented on GitHub (Mar 29, 2018): ATM i have no link, put i can you post here a part of my solution. For me, it works very good. Don´t know if do this for you, too.... In "SharpCompress.Archives.Rar.FileInfoRarFilePart.cs" change it in this manner: internal override string FilePartName { get { return FileInfo.Name; //return "Rar File: " + FileInfo.FullName // + " File Entry: " + FileHeader.FileName; } } The Rest i´ve done is made with vb.net, so you have to convert it to c#. And this is only a little part of the solution... And a little bit old code, because i´m not at home :D This is the important thing... In my project Label11 is the Label wich shows the actual volume (e.g. "test.r08") Private Sub archive_FilePartExtractionBegin(ByVal sender As Object, ByVal e As FilePartExtractionBeginEventArgs) Label11.Text = e.Name End Sub Private Sub PrintVolumes(ByVal ArchivePath As String) Using archive As IArchive = getIArchive(ArchivePath, Nothing) AddHandler archive.FilePartExtractionBegin, AddressOf archive_FilePartExtractionBegin For Each entry As IArchiveEntry In archive.Entries If Not entry.IsDirectory Then Label3.Text = entry.Key Label5.Text = entry.CompressedSize.ToString Label7.Text = entry.Size.ToString Label9.Text = archive.Volumes.Count.ToString entry.WriteToDirectory(dest, Nothing) End If Next End If End Using End Sub
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#282