private void GetFiles(DirectoryInfo dir, ProjectFolderNode nodeToAddTo, FitProj p) { foreach (var fileinfo in dir.GetFiles()) { if (fileinfo.Name.EndsWith(".fitproj", StringComparison.InvariantCultureIgnoreCase)) { break; } var child = new ProjectFileNode() { Text = fileinfo.Name }; child.Tag = fileinfo; foreach (var f in p.IncludedFiles) { if (fileinfo.FullName.Contains(f.RelativePath)) { nodeToAddTo.Nodes.Add(child); break; } } } }
private void GetDirectories(DirectoryInfo[] subDirs, ProjectFolderNode nodeToAddTo, FitProj p) { ProjectFolderNode aNode; DirectoryInfo[] subSubDirs; foreach (DirectoryInfo subDir in subDirs) { aNode = new ProjectFolderNode() { Text = subDir.Name }; aNode.Tag = subDir; subSubDirs = subDir.GetDirectories(); if (subSubDirs.Length != 0) { GetDirectories(subSubDirs, aNode, p); } GetFiles(subDir, aNode, p); nodeToAddTo.Nodes.Add(aNode); } }