void GetFolderContent(Project project, string folder, out ProjectFileCollection files, out ArrayList folders) { files = new ProjectFileCollection (); folders = new ArrayList (); string folderPrefix = folder + Path.DirectorySeparatorChar; foreach (ProjectFile file in project.ProjectFiles) { string dir; // Resource files are shown in a special resource folder (?!?!). if (file.BuildAction == BuildAction.EmbedAsResource) continue; if (file.Subtype != Subtype.Directory) { dir = Path.GetDirectoryName (file.Name); if (dir == folder) { files.Add (file); continue; } } else dir = file.Name; if (dir.StartsWith (folderPrefix)) { int i = dir.IndexOf (Path.DirectorySeparatorChar, folderPrefix.Length); if (i != -1) dir = dir.Substring (0,i); if (!folders.Contains (dir)) folders.Add (dir); } } }
void GetAllFilesRecursive(string path, ProjectFileCollection files) { if (File.Exists (path)) { files.Add (new ProjectFile (path)); return; } foreach (string file in Directory.GetFiles (path)) files.Add (new ProjectFile (file)); foreach (string dir in Directory.GetDirectories (path)) GetAllFilesRecursive (dir, files); }