/// <summary> /// recurcievly build the tree structure that represents the configuration folder. /// </summary> /// <param name="sDir"></param> /// <param name="sTreeSons"></param> private void DirSearch(string sDir, List <ProjectExplorerItem> sTreeSons) { try { if (IsFile(sDir)) { return; } foreach (string f in Directory.GetFiles(sDir, "*.json")) { if (f.Contains("\\Enums.json")) { continue; } sTreeSons.Add(new ProjectExplorerItem(f, this, PM)); } foreach (string d in Directory.GetDirectories(sDir)) { if (!Directory.EnumerateFileSystemEntries(d).Any()) { continue; } ProjectExplorerItem t = new ProjectExplorerItem(d, this, PM); sTreeSons.Add(t); } } catch (System.Exception excpt) { MessageBox.Show(excpt.Message); } }
public ProjectModel(string root_path) { RootPath = root_path; GlobalEnums.Reset(); GlobalEnums.LoadEnums(RootPath); RootExplorerItem = new ProjectExplorerItem(RootPath, this, this); GlobalEnums.NotifyOnChangeTo(this); FocusedTab = -1; }
private List <ProjectExplorerItem> AuxGetAllProjectExplorerItems(ProjectExplorerItem curr) { if (curr.ProjectExplorerItems.Count > 0) { List <ProjectExplorerItem> l = new List <ProjectExplorerItem>(); foreach (ProjectExplorerItem p in curr.ProjectExplorerItems) { l.AddRange(AuxGetAllProjectExplorerItems(p)); } return(l); } return(new List <ProjectExplorerItem>() { curr }); }