public override IList <ModelTreeNode> LoadTree(string path) { var directory = Path.GetDirectoryName(path); var folderTreeNode = new FolderTreeNode(); var shopPaths = Directory.EnumerateFiles(directory, "*.shop"); folderTreeNode.Text = directory; foreach (var filePath in shopPaths) { var json = File.ReadAllText(filePath); var item = JsonConvert.DeserializeObject <NpcShop>(json); item.Filename = Path.GetFileName(filePath); var node = new NpcShopTreeNode(item); folderTreeNode.Nodes.Add(node); } folderTreeNode.Expand(); return(new List <ModelTreeNode>() { folderTreeNode }); }
public FolderTreeView() { this.FullRowSelect = false; this.HideSelection = false; this.LabelEdit = false; this.PathSeparator = Path.PathSeparator.ToString(); this.Scrollable = true; this.ShowLines = true; this.ShowNodeToolTips = false; this.ShowPlusMinus = true; this.ShowRootLines = true; FolderTreeNode rootNode = new FolderTreeNode(_rootShellItem); this.Nodes.Add(rootNode); rootNode.Expand(); }