TL;DR
the sample code given on the site's home page does not compile. How to list all the volumes in a multi-part RAR file?
Problem definition
I have a Windows 10 folder with lots of multi-part RAR files. The 'root' rar and its parts need to be segregated and then moved into their own folders. I can do this manually by creating a folder and inspecting the file names such that the root rar and then 'part01.rar', 'part02.rar', etc. are all in the same directory.
When there are dozens of multi-part files the manual process is tedious, so I am writing a C# app. What I have learned so far is that the naming conventions with these multi-part RAR files is not consistent and this has left me in the awkward exercise of examining their file names and inferring where they belong by string manipulation. Uncool.
So I am importing SharpCompress with a view towards getting the file names scientifically and precisely. There is an example on on its documentation page which appears to do EXACTLY what I want. I have wrapped a method around it and now present it to you as 'what I have tried'.
private static void GetFileNames(FileInfo rarFileInfo)
{
var archive = ArchiveFactory.Open(rarFileInfo.FullName);
foreach (var entry in archive.Entries)
{
if (!entry.IsDirectory)
{
Console.WriteLine(entry.FilePath);
}
}
}
...and note the red text produced by VS...
It doesn't compile because 'FilePath' cannot be resolved! Do I have the wrong framework? I am using .NET 4.5 under VS2013. Theoretically there should be a lot of questions in here already because the documentation sample on the home site doesn't compile, but there's not (I checked).
Question: How to use SharpCompress to identify all the volumes associated with a given RAR such that their names can be available to a developer.
NOTE: I could also use the WinRar API to unpack the files into their own directories, but this is not what the client wants. I will actually unpack them later, the object is to get all the associated volumes together in their own folders.