public CourseFolder[] GetFolders() { if (folders == null) { // TODO: Optimize Course.GetFolders() regex. var contentIds = Regex.Matches(GetSource(), "content_id=(_[0-9]*_[0-9]*?).*?<span.*?>(.*?)</span>"); folders = new CourseFolder[contentIds.Count]; for (int i = 0; i < folders.Length; ++i) { folders[i] = new CourseFolder(Session, Id, contentIds[i].Groups[1].Value, contentIds[i].Groups[2].Value); } } return(folders); }
public CourseFolder[] GetFolders(bool update = false) { if (folders == null) { // TODO: Optimize CourseFolder.GetFolders() regex. MatchCollection folderMatches = Regex.Matches(GetSource(update), "content_id=(_[0-9]*_[0-9]*?)\".*?<span.*?>(.*?)</span>"); folders = new CourseFolder[folderMatches.Count]; for (int i = 0; i < folders.Length; ++i) { folders[i] = new CourseFolder(Session, courseId, folderMatches[i].Groups[1].Value, folderMatches[i].Groups[2].Value); } } return(folders); }