I'm not entirely sure what you mean when you say "read the files form the DVD", but you can use the following to get all of the files on each of your CD/DVD drives
static IEnumerable<string> getDirectoryFilePaths(string path)
{
List<string> filePaths = new List<string>();
try
{
// recursively look through all of the folders
foreach (var dir in Directory.GetDirectories(path, "*"))
{
filePaths.AddRange(getDirectoryFilePaths(dir));
}
}
catch (UnauthorizedAccessException)
{
// skip this stuff
}
// add the files directly in the current drive/folder
filePaths.AddRange(Directory.GetFiles(path, "*").ToList());
return filePaths;
}
static void Main(string[] args)
{
// Get all of the ready CD drives
foreach (var cdDrive in DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.CDRom && d.IsReady))
{
// Start at the drive and get all of the files recursively
IEnumerable<string> driveFiles = getDirectoryFilePaths(cdDrive.Name);
foreach (var file in driveFiles)
{
// do something with the files...
using (FileStream fs = File.OpenRead(file))
{
//...
}
}
}
}
Obviously you can change the code to grab a specific drive rather than looking at all available, but hopefully this gets you going.