I am building an app to extract from tar and rar archives. I can report progress from target based on the amount of rar containing in the target and as each one is extracted. In the rars there is one file spanning several volumes. I have used the code off the unit tests examples
var streams = testArchives.Select(s => Path.Combine(SCRATCH2_FILES_PATH, s)).Select(File.OpenRead).ToList();
using (var reader = RarReader.Open(streams))
{
while (reader.MoveToNextEntry())
{
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, new ExtractionOptions()
{
ExtractFullPath = true,
Overwrite = true
});
}
}
The problem is that the process does not report until the current entry has extracted.
Don't use WriteEntryToDirectory to save the files, because it doesn't contain callback progress, instead of that, use FileStream and then get the full size of the uncompressed file and slice the save progress ok?
Here is a simple example: