public IEnumerator <DataNode> GetEnumerator() { DataNode dataNode = new DirectoryDataNode(_pathRoot); dataNode.Expand(); foreach (DataNode childNode in EnumerateNodes(dataNode, _pathParts)) { yield return(childNode); } }
private void OpenPaths(string[] paths) { _nodeTree.Nodes.Clear(); foreach (string path in paths) { if (Directory.Exists(path)) { DirectoryDataNode node = new DirectoryDataNode(path); _nodeTree.Nodes.Add(CreateUnexpandedNode(node)); AddPathToHistory(GetRecentDirectories(), path); } else if (File.Exists(path)) { DataNode node = null; foreach (var item in FileTypeRegistry.RegisteredTypes) { if (item.Value.NamePatternTest(path)) node = item.Value.NodeCreate(path); } if (node != null) { _nodeTree.Nodes.Add(CreateUnexpandedNode(node)); AddPathToHistory(GetRecentFiles(), path); } } } if (_nodeTree.Nodes.Count > 0) { _nodeTree.Nodes[0].Expand(); } UpdateUI(); UpdateOpenMenu(); }
private void OpenPaths (IEnumerable<string> paths) { _dataSource.Nodes.Clear (); _mainOutlineView.ReloadData (); foreach (string path in paths) { if (Directory.Exists (path)) { DirectoryDataNode node = new DirectoryDataNode (path); _dataSource.Nodes.Add (new TreeDataNode (node)); // AddPathToHistory(Settings.Default.RecentDirectories, path); } else if (File.Exists (path)) { DataNode node = null; foreach (var item in FileTypeRegistry.RegisteredTypes) { if (item.Value.NamePatternTest(path)) node = item.Value.NodeCreate(path); } if (node != null) { _dataSource.Nodes.Add(new TreeDataNode(node)); //AddPathToHistory(Settings.Default.RecentFiles, path); } } } if (_dataSource.Nodes.Count > 0) { _mainOutlineView.ExpandItem(_dataSource.Nodes[0]); } _mainOutlineView.ReloadData(); UpdateUI(); }
public int OpenPaths (string[] paths) { _nodeTree.Nodes.Clear(); int failCount = 0; foreach (string path in paths) { if (Directory.Exists(path)) { DirectoryDataNode node = new DirectoryDataNode(path); _nodeTree.Nodes.Add(CreateUnexpandedNode(node)); } else if (File.Exists(path)) { DataNode node = null; foreach (var item in FileTypeRegistry.RegisteredTypes) { if (item.Value.NamePatternTest(path)) node = item.Value.NodeCreate(path); } if (node == null) node = NbtFileDataNode.TryCreateFrom(path); if (node != null) _nodeTree.Nodes.Add(CreateUnexpandedNode(node)); else failCount++; } } if (_nodeTree.Nodes.Count > 0) { _nodeTree.Nodes[0].Expand(); } OnSelectionInvalidated(); return failCount; }