private static void DirSearch(string sDir) { try { foreach (string f in Directory.GetFiles(sDir)) { string fileName = Path.GetFileName(f); bool exclude = extensionExclude.Any(item => fileName.EndsWith(item)) || fileExclude.Any(item => fileName == item); if(!exclude) { string subdir = GetRelativePath(currentDir, Path.GetDirectoryName(f)); DownloadElement element = new DownloadElement(url, fileName, subdir); downloadList.Add(element); } } foreach (string d in Directory.GetDirectories(sDir)) { DirSearch(d); } } catch { Console.WriteLine("Failed during dir seach"); } }
public void AddDownloadElement(DownloadElement element) { this.Task.DownloadElement.Add(element); }