예제 #1
0
        private void LbxSearchResultsMouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (m_lbxSearchResults.SelectedItem == null)
            {
                return;
            }
            var        result = m_lbxSearchResults.SelectedItem as SearchResult;
            FSNodeFile file   = FileManager.AttribTree.RootNode.GetFileByPath(result.RelativeFilePath);
            UniFile    uni    = file.GetUniFile();

            FileManager.LoadFile(uni);
        }
예제 #2
0
        private void TryToOpenFileByValueToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (m_dgvValues.SelectedRows.Count <= 0 || (string)m_dgvValues.SelectedRows[0].Cells[2].Value != "string")
            {
                return;
            }
            if (m_dgvValues.SelectedRows[0].Cells[1].Value == null)
            {
                UIHelper.ShowError("The selected value is not a valid path.");
                return;
            }

            string path = (string)m_dgvValues.SelectedRows[0].Cells[1].Value + ".rbf";

            if (FileManager.AttribTree != null)
            {
                FSNodeFile node = FileManager.AttribTree.RootNode.GetFileByPath("simulation\\attrib\\" + path);
                if (node == null)
                {
                    UIHelper.ShowError(
                        "Could not open the selected file. Maybe it does not exist or the tool could not find it.");
                    return;
                }
                UniFile file = node.GetUniFile();
                if (file == null)
                {
                    UIHelper.ShowError(
                        "Could not open the selected file. Maybe it does not exist or the tool could not find it.");
                    return;
                }
                if (!FileManager.AllowOpeningFilesTwice && FileManager.OpenFiles.Contains(file.FilePath))
                {
                    UIHelper.ShowWarning(
                        "You're already editing the file you're trying to load! You cannot reopen it." +
                        " View the options-menu to remove this limitation.");
                    return;
                }
                FileManager.LoadFile(file);
                return;
            }
            UIHelper.ShowError(
                "Could not open the selected file. There's no file-tree available to look the path up." +
                " This might be because there's no mod loaded.");
        }