Extracting multipart rar for Universal app #51

Closed
opened 2026-01-29 22:05:47 +00:00 by claunia · 5 comments
Owner

Originally created by @kristwa on GitHub (Jul 30, 2015).

Hi,

I'm testing out creating Universal apps for Windows 10 and I'm trying to extract multipart rar files. It starts out fine but I'm getting error: "Multi-part rar file is incomplete. Entry expects a new volume: filename.ext". Extracting file with WinRAR is no problem, so there should not be any issues with my archive.

Here is my code:

using (var stream = await file.OpenAsync(FileAccessMode.Read))
                    {
                        var archive = ArchiveFactory.Open(stream.AsStreamForRead());

                        foreach (var entry in archive.Entries)
                        {
                            if (!entry.IsDirectory)
                            {
                                _sourceAnalysis.Files.Add(entry.Key);

                                var entryStream = entry.OpenEntryStream();

                                var extractedFile = await _settings.SourceStorageFolder.CreateFileAsync(entry.Key,CreationCollisionOption.ReplaceExisting);

                                using (var outputStream = await extractedFile.OpenStreamForWriteAsync())
                                {
                                    await entryStream.CopyToAsync(outputStream);
                                }
                            }
                        }
                    }

Any ideas as to what might be wrong?

Originally created by @kristwa on GitHub (Jul 30, 2015). Hi, I'm testing out creating Universal apps for Windows 10 and I'm trying to extract multipart rar files. It starts out fine but I'm getting error: "Multi-part rar file is incomplete. Entry expects a new volume: filename.ext". Extracting file with WinRAR is no problem, so there should not be any issues with my archive. Here is my code: ``` csharp using (var stream = await file.OpenAsync(FileAccessMode.Read)) { var archive = ArchiveFactory.Open(stream.AsStreamForRead()); foreach (var entry in archive.Entries) { if (!entry.IsDirectory) { _sourceAnalysis.Files.Add(entry.Key); var entryStream = entry.OpenEntryStream(); var extractedFile = await _settings.SourceStorageFolder.CreateFileAsync(entry.Key,CreationCollisionOption.ReplaceExisting); using (var outputStream = await extractedFile.OpenStreamForWriteAsync()) { await entryStream.CopyToAsync(outputStream); } } } } ``` Any ideas as to what might be wrong?
Author
Owner

@adamhathcock commented on GitHub (Jul 31, 2015):

The issue is that using the stream overload for open means that the code doesn't know where to look for the next volume file. Either give Open a path or you have to give all the volume streams at once and in order.

@adamhathcock commented on GitHub (Jul 31, 2015): The issue is that using the stream overload for open means that the code doesn't know where to look for the next volume file. Either give Open a path or you have to give all the volume streams at once and in order.
Author
Owner

@kristwa commented on GitHub (Jul 31, 2015):

The only static method allowed on ArchiveFactory seems to be Open(Stream, Options) for Universal apps

@kristwa commented on GitHub (Jul 31, 2015): The only static method allowed on ArchiveFactory seems to be Open(Stream, Options) for Universal apps
Author
Owner

@adamhathcock commented on GitHub (Jul 31, 2015):

Look at RarArchiveFactory

@adamhathcock commented on GitHub (Jul 31, 2015): Look at RarArchiveFactory
Author
Owner

@kristwa commented on GitHub (Jul 31, 2015):

Got it working using RarArchive.Open(streams). Requires a lot more manual labor on my end if I'm going to create something that supports any kind of multi-rar, ordinary rar or zip though. But I guess that should be achievable. Thanks.

@kristwa commented on GitHub (Jul 31, 2015): Got it working using RarArchive.Open(streams). Requires a lot more manual labor on my end if I'm going to create something that supports any kind of multi-rar, ordinary rar or zip though. But I guess that should be achievable. Thanks.
Author
Owner

@adamhathcock commented on GitHub (Jul 31, 2015):

You could implement file stuff for UWP. I just didn't do it as making a portable library that doesn't access the file system directly was easier

@adamhathcock commented on GitHub (Jul 31, 2015): You could implement file stuff for UWP. I just didn't do it as making a portable library that doesn't access the file system directly was easier
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#51