private void sbtnOpen_Click(object sender, EventArgs e) { fileTree.Nodes.Clear(); openSolutionDialog.Filter = "Xml文件|*.xml"; if (openSolutionDialog.ShowDialog() == DialogResult.OK) { _solution = XmlExtension.ReadToEntity<GSolution>(openSolutionDialog.FileName); var snode = AddTreeNode(null, _solution); foreach (var p in _solution.Projects) { var pnode = AddTreeNode(snode, p); foreach (var f in p.Folders) { var fnode = AddTreeNode(pnode, f); foreach (var fn in f.Files) { AddTreeNode(fnode, fn); } } foreach (var fn in p.Files) { AddTreeNode(pnode, fn); } } } }
void AddSolution(string name, string path) { path = path + "\\" + name; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } _solution = new GSolution(path) { Text = name }; var node = new TreeNode(name); node.ImageIndex = (int)ImageListEnum.Solution; node.SelectedImageIndex = node.ImageIndex; node.Tag = _solution; fileTree.Nodes.Add(node); }