public void SetCurrentDirectory(string path) { string[] folders = tagLibrary.GetFolderList(path); string[] files = tagLibrary.GetFileList(path, this.filter); this.tagList.Clear(); this.tagList.Columns.Clear(); this.tagList.Columns.AddRange( new ColumnHeader[] { this.columnHeader1 }); tagList.Columns[0].Width = tagList.Width; // TODO: Look at making these methods return empty string arrays, rather than null. if (folders != null) { foreach (string folder in folders) { CreateFolder(folder); } } if (files != null) { foreach (string file in files) { CreateFile(file); } } }
protected virtual void AddFiles(TreeNode parentNode, string path) { // Take care of folders first so they will be at the top. if (this.tagLibraryEnabled) { string[] folders = tagLibrary.GetFolderList(path); if (folders != null) { Array.Sort(folders); foreach (string folder in folders) { parentNode.Nodes.Add(CreateFolderNode(folder)); } } } if (this.masterLibraryEnabled) { string[] folders = masterArchive.GetFolderList(path); if (folders != null) { Array.Sort(folders); foreach (string folder in folders) { // Check is this folder exists in the tag library. bool createNode = true; if (this.tagLibraryEnabled) { if (tagLibrary.FolderExists(path + folder)) { createNode = false; } } if (createNode) { TreeNode node = CreateFolderNode(path + folder, true); node.NodeFont = new Font(tagTree.Font, FontStyle.Bold); parentNode.Nodes.Add(node); } } } } if (this.showFiles) { if (this.tagLibraryEnabled) { string[] files = tagLibrary.GetFileList(path); if (files != null) { Array.Sort(files); foreach (string file in files) { parentNode.Nodes.Add(CreateFileNode(file)); } } } if (this.masterLibraryEnabled) { string[] files = masterArchive.GetFileList(path); if (files != null) { Array.Sort(files); foreach (string file in files) { string lowercaseFile = file.ToLower(); // Check is this file exists in the tag library. bool createNode = true; if (this.tagLibraryEnabled) { if (tagLibrary.FileExists(path + lowercaseFile)) { createNode = false; } } if (createNode) { TreeNode node = CreateFileNode(path + lowercaseFile, true); node.NodeFont = new Font(tagTree.Font, FontStyle.Bold); parentNode.Nodes.Add(node); } } } } } }