Esempio n. 1
0
        private void AssetBrowser_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(m_assetRoot))
            {
                return;
            }

            m_assetFolderTree.BeginUpdate();
            m_assetFolderTree.Nodes.Clear();

            Node root = ResFormUtil.CreateNode(new DirectoryInfo(m_assetRoot));

            m_assetFolderTree.Nodes.Add(root);

            // load all subnodes recursively manually
            LoadDirectories(root, (DirectoryInfo)root.Tag, true);

            m_assetFolderTree.EndUpdate();

            // load last opened dir
            string prevPath = Properties.Settings.Default.RecentAccessedAssetDir;

            if (!string.IsNullOrEmpty(prevPath) && Directory.Exists(prevPath))
            {
                DirectoryInfo prevDI = new DirectoryInfo(prevPath);
                TryExpandAndSelectNode(m_assetFolderTree.Nodes[0], prevPath);
            }
        }
Esempio n. 2
0
        private void LoadDirectories(Node parent, DirectoryInfo directoryInfo, bool recursively)
        {
            DirectoryInfo[] directories = directoryInfo.GetDirectories();
            foreach (DirectoryInfo dir in directories)
            {
                if ((dir.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                {
                    continue;
                }

                Node node = ResFormUtil.CreateNode(dir);
                parent.Nodes.Add(node);

                if (recursively)
                {
                    LoadDirectories(node, dir, recursively);
                }
            }
        }