المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Copy Files in C# with Duplicate Files (Corrupt ISO)



C# Programming
09-19-2009, 06:31 AM
So I am having a problem. I generated about 100 ISO's files of my movies so I can stream them to my TV. Well now I find out I dont need them in ISO, I need AVI. I am trying to open the ISO and the tool that was used created 2 versions of the same file in the same folder. 1 with 0 bytes and 1 with full bytes. Now here is my question from a C# point of view. I am mounting the ISO as a Drive in Windows and copying all but the 0 byte file out. Works fine in Windows. I want to automate this by having c# Mount the Image and copy the files out. I use the System.IO.Directory.GetFiles and build a array of files. When I go through the array to copy the files, I reference by filename which always get the 0 byte file and not the correct file. I cant delete the 0 byte file as it gets mounted as a CD which is read only. Is there any way to reference a file by some internal ID rather than filename in c#?


private void button1_Click(object sender, EventArgs e)
{
List sFilestoProcess;
List sCopyFiles;

sFilestoProcess = GetISOtoProcess();

foreach (string sFile in sFilestoProcess)
{
Mount(sFile);
sCopyFiles = GetValidFiles();
}
}

private List GetISOtoProcess()
{
List Files = new List();
foreach (string sDirectory in System.IO.Directory.GetFiles(@"D:\"))
{
Files.Add(sDirectory);
}

return Files;
}