private FileData FindFileData(FileData start, string[] path, int startIndex)
{
if (startIndex >= path.Length || start == null)
{
return start;
}
string subfileName = path[startIndex];
FileData found = null;
foreach (FileData openedFile in start.OpenedFiles)
{
if (openedFile.FileName.Equals(subfileName))
{
found = openedFile;
break;
}
}
if (found == null)
{
foreach (FileData openedFile in start.RelatedFiles)
{
if (openedFile.FileName.Equals(subfileName))
{
found = openedFile;
break;
}
}
}
return FindFileData(found, path, startIndex + 1);
}