public static CourseWithChapters Load(string folderName, string urlName, EdxLoadOptions options) { return(Load <CourseWithChapters>(folderName, "course", urlName, options, c => { c.Chapters = c.ChapterReferences.Select(x => Chapter.Load(folderName, x.UrlName, options)).ExceptNulls().ToArray(); c.ChapterReferences = c.Chapters.Select(v => v.GetReference()).ToArray(); })); }
public static CourseWithChapters Load(string folderName, string urlName) { try { var courseWithChapters = new FileInfo(string.Format("{0}/course/{1}.xml", folderName, urlName)).DeserializeXml <CourseWithChapters>(); courseWithChapters.UrlName = urlName; courseWithChapters.Chapters = courseWithChapters.ChapterReferences.Select(x => Chapter.Load(folderName, x.UrlName)).ToArray(); return(courseWithChapters); } catch (Exception e) { throw new Exception(string.Format("Course {0} load error", urlName), e); } }