public void OpenFile(string filePath, bool reset = true) { if (reset) { Reset(); } // Determine current configuration ConfigurationList.Instance.DetermineCurrentConfiguration(filePath); // Create the node var node = DataNodeFactory.Create(filePath); // Wrap the node and add it to the tree view var wrappedNode = new DataTreeNode(node); mTreeView.Nodes.Add(wrappedNode); // Restore menu items mSaveToolStripMenuItem.Enabled = true; mSaveAsToolStripMenuItem.Enabled = true; mCloseToolStripMenuItem.Enabled = true; // Update the title to have the name of node Text = $"Miku Miku Model - {node.Name}"; // Update the file path for the save method mCurrentlyOpenFilePath = filePath; // Expand the node // TODO: Expanding a large farc archive will lock up the program wrappedNode.Expand(); }
protected override void OnDragDrop(DragEventArgs drgevent) { string[] filePaths = (string[])drgevent.Data.GetData(DataFormats.FileDrop, false); if (filePaths.Length >= 1 && !AskForSavingChanges()) { string filePath = filePaths[0]; // just a quick test bool isDirectory = false; // System.IO.Directory.Exists(filePath); if (isDirectory) { foreach (var file in System.IO.Directory.GetFiles(filePath, "*.*", System.IO.SearchOption.AllDirectories)) { mTreeView.Nodes.Add(new DataTreeNode(DataNodeFactory.Create(file))); } } else { OpenFile(filePath); } } base.OnDragDrop(drgevent); }
protected override void OnInitializeView() { for (var i = 0; i < Data.Count; i++) { var item = Data[i]; AddNode(DataNodeFactory.Create(mGetItemNameDelegate(i, item), item)); } }
private void MOpenToolStripMenuItem_Click(object sender, System.EventArgs e) { using (var dlg = new OpenFileDialog()) { if (dlg.ShowDialog() != DialogResult.OK) { return; } var modelPackNode = DataNodeFactory.Create(Path.GetFileName(dlg.FileName), new ModelPack(dlg.FileName)); mDataTreeView.TopNode = new DataTreeNode(modelPackNode); } }