public void Add(AssemblyTreeFile file) { AssemblyTreeFolder curFolder = rootFolder; if (!String.IsNullOrEmpty(file.Path)) { AssemblyTreeFolder parentFolder = rootFolder; string[] folders = file.Path.Split('\\'); foreach (string folderName in folders) { curFolder = parentFolder.FindFolder(folderName); if (curFolder == null) { curFolder = new AssemblyTreeFolder(folderName); parentFolder.Add(curFolder); } parentFolder = curFolder; } } curFolder.Add(file); }
private void UpdateClassicTree() { try { // update complete tree if (assemblyTreeView.LastType != AssemblyTreeType.Classic) { this.assemblyTreeView.ClearNodes(); AssemblyTreeFile curFile = null; foreach (ScriptFile sf in this.fileManager.ScriptManager.GetAllSFs()) { AssemblyTreeFile file = new AssemblyTreeFile(sf); if (sf == this.fileManager.CurrentFile) { curFile = file; } if (sf.SecondSI != null) { foreach (UsingInfo u in sf.SecondSI.Usings) { file.Add(new AssemblyTreeMember(u)); } foreach (ConstInfo c in sf.SecondSI.Constants) { file.Add(new AssemblyTreeMember(c)); } foreach (FuncInfo f in sf.SecondSI.Functions) { file.Add(new AssemblyTreeMember(f)); } } this.assemblyTreeView.Add(file); } this.assemblyTreeView.CurrentNode = curFile; this.assemblyTreeView.RefreshNodes(); } else // update only changed sfs { // TODO: update informácií v strome po aktualizácii //this.assemblyTreeView.ClearNodes(); AssemblyTreeFile curFile = null; List <ScriptFile> updatedFiles = this.fileManager.ThreadedSM.CurrentUpdatedFiles.Clear(); foreach (ScriptFile sf in updatedFiles) { Main.Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "TREE - Updating file " + sf.ToString()); AssemblyTreeFile file = this.assemblyTreeView.FindFile(sf); if (file != null) { AssemblyTreeFolder folder = file.ParentFolder; folder.Remove(file); file = new AssemblyTreeFile(sf); folder.Add(file); } else { file = new AssemblyTreeFile(sf); this.assemblyTreeView.Add(file); } if (sf == this.fileManager.CurrentFile) { curFile = file; } if (sf.SecondSI != null) { foreach (UsingInfo u in sf.SecondSI.Usings) { file.Add(new AssemblyTreeMember(u)); } foreach (ConstInfo c in sf.SecondSI.Constants) { file.Add(new AssemblyTreeMember(c)); } foreach (FuncInfo f in sf.SecondSI.Functions) { file.Add(new AssemblyTreeMember(f)); } } } this.assemblyTreeView.CurrentNode = curFile; this.assemblyTreeView.RefreshNodes(); } } catch (Exception e) { Main.NotifyError(e); } }