I have found the following code from the internet after a long day of searching and its working though its not producing full file names and extensions of the files and folders in the iso image. It is truncating the file and folder names to produce a maximun of 8 character name as well as 3 character file extensions/ This means that all filenames longer than * characters will not be written correctly and all other file extensions with ,more than 3 characters will not be written correctly as well. thank you for reading. I really need your help.
ExtractISO(string ISOName, string ExtractionPath)
{
using (FileStream ISOStream = File.Open(ISOName, FileMode.Open))
{
CDReader Reader = new CDReader(ISOStream, true, true);
ExtractDirectory(Reader.Root, ExtractionPath + Path.GetFileNameWithoutExtension(ISOName) + "\\", "");
Reader.Dispose();
}
}
void ExtractDirectory(DiscDirectoryInfo Dinfo, string RootPath, string PathinISO)
{
if (!string.IsNullOrWhiteSpace(PathinISO))
{
PathinISO += "\\" + Dinfo.Name;
}
RootPath += "\\" + Dinfo.Name;
AppendDirectory(RootPath);
foreach (DiscDirectoryInfo dinfo in Dinfo.GetDirectories())
{
ExtractDirectory(dinfo, RootPath, PathinISO);
}
foreach (DiscFileInfo finfo in Dinfo.GetFiles())
{
using (Stream FileStr = finfo.OpenRead())
{
using (FileStream Fs = File.Create(RootPath + "\\" + finfo.Name, 4 * 1024))
{
FileStr.CopyTo(Fs, 4 * 1024);
}
}
}
}
static void AppendDirectory(string path)
{
try
{
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
}
catch (DirectoryNotFoundException Ex)
{
AppendDirectory(Path.GetDirectoryName(path));
}
catch (PathTooLongException Ex)
{
AppendDirectory(Path.GetDirectoryName(path));
}
}
private void btnExtractIso_Click(object sender, EventArgs e)
{
ExtractISO("C:\\Users\\tjdtud\\Desktop\\done\\publish.iso", "C:\\Users\\tjdtud\\Desktop\\extracted\\");
}
code taken from this article href="http://stackoverflow.com/questions/10579964/extract-iso-with-winrar-automatically-with-c-sharp-or-batch
Thank you for the so much needed help