private void dependenciesListBox_DoubleClick(object sender, EventArgs e)
{
if (mSelectedFileData == null)
{
return;
}
ListBox listBox = sender as ListBox;
string selectedItem = (string)listBox.SelectedItem;
if (selectedItem == null)
{
return;
}
if (selectedItem.Contains(":"))
{
// item is a alias item. we should navigate there.
ModuleFile file = ModuleDataManager.GetInstance().GetModuleFile(selectedItem);
if (file != null)
{
SetSelectedFileData(file.FileData);
}
}
else
{
string fileName = System.IO.Path.GetFileNameWithoutExtension(selectedItem);
bool foundFile = false;
foreach (TabPage tabPage in filePreviewTabs.TabPages)
{
string tabName = tabPage.Text.Replace("*", "").Trim();
if (tabName.Equals(fileName))
{
filePreviewTabs.SelectedTab = tabPage;
foundFile = true;
break;
}
}
if (!foundFile)
{
FileData data;
bool hasFileData = false;
if (mSelectedFileData.ReferencedByFileData.TryGetValue(selectedItem, out data))
{
hasFileData = true;
}
string fullPath = ModuleDataManager.GetInstance().ModsDirectoryPath + selectedItem;
if (!hasFileData && mSelectedFileData.LinkedFileData.TryGetValue(fullPath, out data))
{
hasFileData = true;
}
if (hasFileData)
{
SetSelectedFileData(data);
if (data.TreeNode != null)
{
treeView.SelectedNode = data.TreeNode;
}
}
}
}
}