Question

I'm trying to extract an ISO using C#, I found a Winzip library, DotNetZip, and used that but when I run the project it says that it cannot extract the ISO.

string activeDir = copyTo = this.folderBD.SelectedPath;;

folderName = toExtract.Remove(toExtract.Length - 4, 4);

Path.Combine(activeDir,  Path.GetFileNameWithoutExtension(folderName));

string zipToUnpack = toExtract;
string unpackDirectory = folderName;

using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
{
    // here, we extract every entry, but we could extract conditionally
    // based on entry name, size, date, checkbox status, etc.  
    foreach (ZipEntry file in zip1)
    {
        file.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
    }
}

That is the code I am working with. copyTo and folderName are sent in from other methods in the program.

Any libraries that let me use Winzip or Winrar on a ISO would be a great help, but so far my searches have thrown up nothing.

Thanks in advance

EDIT: Can you only extract .rar or .zip using winrar with C# or can you pass the file to be extracted as a arguement and how? I've tried

ProcessStartInfo startInfo = new ProcessStartInfo("winrar.exe"); Process.Start("winrar.exe",@"C:\file\to\be\extracted");

The ISO location, but that returns an exception that there is nothing to extract there.

Was it helpful?

Solution

You can execute winrar from c# using Process.Start and pass in the arguments you need to extract the iso.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top