private void AddCreatedTreeRootNode(RootNode rootNode, bool add) { runTreeView.BeginUpdate(); if (!add) { runTreeView.Nodes.Clear(); } rootNode.Expand(); runTreeView.Nodes.Add(rootNode); runTreeView.EndUpdate(); }
public static void AddDirectory(RootNode rootNode, bool includeSubDirs) { if (rootNode.CanAddGroup()) { FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.SelectedPath = System.IO.Directory.GetCurrentDirectory(); if (dialog.ShowDialog() == DialogResult.OK) { RootNode dirNode = AddSubDirs(dialog.SelectedPath, includeSubDirs); if (dirNode == null) { MessageBox.Show("No xml testfiles in directory"); } else { rootNode.Nodes.Add(dirNode); rootNode.Expand(); } } } }
private RootNode GetTreeRootNode(RootNode childNode) { RootNode parentNode = childNode; while(parentNode.Parent != null) { parentNode = (RootNode) parentNode.Parent; } return parentNode; }
private void CreateTreeNode(string root, bool add) { RootNode rootNode = new RootNode(root); AddCreatedTreeRootNode(rootNode, add); }
public static List<RootNode> OpenFileInternal(ConfigArgumentControl cfgArgCtrl, string fileName) { List<RootNode> resultList = new List<RootNode>(); XmlDocument doc = new XmlDocument(); doc.Load(fileName); XmlNode rootElement = doc.FirstChild; if (rootElement == null || rootElement.Name != "seeflawgui") { MessageBox.Show("Xmlfile does not start with a seeflawgui node"); return resultList; } cfgArgCtrl.RemoveAllArguments(); XmlNode configElement = GetElementByName(rootElement, "config"); if (configElement != null) { foreach (XmlAttribute attr in configElement.Attributes) { cfgArgCtrl.AddArgument(attr.Name, attr.Value); } } foreach (XmlNode treeNode in rootElement.ChildNodes) { if (treeNode.Name == "tree") { XmlAttribute dirAttr = GetAttributeByName(treeNode, "dir"); if (dirAttr != null) { if (System.IO.Directory.Exists(dirAttr.Value)) { RootNode rootNode = CreateRootDirectory(dirAttr.Value); if (rootNode != null) { resultList.Add(rootNode); } } else { System.Console.WriteLine("No such directory exist " + dirAttr.Value); } } else { XmlAttribute nameAttr = GetAttributeByName(treeNode, "name"); { if (nameAttr != null) { RootNode rootNode = new RootNode(nameAttr.Value); foreach (XmlNode childNode in treeNode.ChildNodes) { RootNode child = BuildTree(childNode); if (child != null) { rootNode.Nodes.Add(child); } } resultList.Add(rootNode); } } } } } return resultList; }
private static RootNode CreateRootDirectory(string rootPath) { RootNode rootNode = null; string rootName = System.IO.Path.GetFileNameWithoutExtension(rootPath); string[] subDirs = System.IO.Directory.GetDirectories(rootPath); if (subDirs.Count() > 0) { foreach (string subDir in subDirs) { RootNode subDirNode = AddSubDirs(subDir, true); if (subDirNode != null) { if (rootNode == null) { rootNode = new RootNode(rootName, rootPath); } rootNode.Nodes.Add(subDirNode); } } } return rootNode; }