public bool LoadDatabase() { bool result = false; TimetableArchive = new List<OneXMLTimetable>(); //load archive timetables List<string> paths = xmlFilePaths(); foreach (string path in paths) { if(!path.EndsWith("-info.xml")) { OneXMLTimetable newTT = new OneXMLTimetable(); if (newTT.Load(path)) { newTT.m_timetableInfo = new TimetableInfo(path, TimetableArchive.Count.ToString()); TimetableArchive.Add(newTT); result = true; } } } //get most recent timetable accordint to creation date OneXMLTimetable mostRecent = TimetableArchive.OrderByDescending(t => t.m_timetableInfo.SemesterStart).OrderByDescending(t => t.m_timetableInfo.Created).First(); this.Copy(mostRecent); return result; }
/// <summary> /// Copy properties (data) from one instance to this. /// </summary> /// <param name="src">Source instance.</param> public void Copy(OneXMLTimetable src) { m_buildings = src.m_buildings; m_classrooms = src.m_classrooms; m_courses = src.m_courses; m_days = src.m_days; m_degreeyears = src.m_degreeyears; m_departments = src.m_departments; m_groupLessonBinder = src.m_groupLessonBinder; m_groups = src.m_groups; m_lecturers = src.m_lecturers; m_lectures = src.m_lectures; m_lessons = src.m_lessons; m_specializations = src.m_specializations; m_times = src.m_times; m_timetableInfo = src.m_timetableInfo; m_xelDefinitions = src.m_xelDefinitions; }