private static void HandleDifferentCourses(IEnumerable <ICourseLink> differentCourses) { foreach (var course in differentCourses) { var dirName = FileNameHelpers.FullyPrepareDirectory(course.Name.TrimInnerSpaces(), true); var linksWithinThisCourse = SharedVars.DownloadQueue .Where(link => link.ParentSection.ParentCourse == course) .ToList(); AdjustExtraPaths(linksWithinThisCourse, courseDirName: dirName, null); HandleDifferentSections(linksWithinThisCourse); } }
private static void HandleDifferentSections(ICollection <IDownloadableLink> commonParentLinks) { var differentSections = commonParentLinks .Select(link => link.ParentSection) .Distinct() .ToList(); if (differentSections.Count > 1) { foreach (var section in differentSections) { var dirName = FileNameHelpers.FullyPrepareDirectory(section.Header.Name, true); var linksWithinThisSection = commonParentLinks .Where(link => link.ParentSection == section) .ToList(); AdjustExtraPaths(linksWithinThisSection, null, dirName); } } }