Exemplo n.º 1
0
        public IEnumerator <DataNode> GetEnumerator()
        {
            DataNode dataNode = new DirectoryDataNode(_pathRoot);

            dataNode.Expand();

            foreach (DataNode childNode in EnumerateNodes(dataNode, _pathParts))
            {
                yield return(childNode);
            }
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
		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();
		}
Exemplo n.º 4
0
        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;
        }