public void AddCourse(Course c) { cl.Add(c); }
// string array to course objects [FINISHED] private void ArrayToCourse(string[] arr, string day, bool oddWeek) { int pointer = 0; if (!oddWeek) { // look for right pointer! pointer = 0; } if (arr[pointer + 1] != "") { // timeArr[pointer] = startTime // timeArr[pointer + 1] = endTime string[] timeArr = arr[pointer + 1].Split('-'); // get start and end time string startTime = timeArr[0]; string endTime = timeArr[1]; // split hours and minutes of starttime int hourStartTime = int.Parse(startTime.Split('u')[0]); int minuteStartTime = int.Parse(startTime.Split('u')[1]); // split hours and minutes of endtime int hourEndTime = int.Parse(endTime.Split('u')[0]); int minuteEndTime = int.Parse(endTime.Split('u')[1]); // make TimeSpan objects TimeSpan startTimeSpan = new TimeSpan(hourStartTime, minuteStartTime, 0); TimeSpan endTimeSpan = new TimeSpan(hourEndTime, minuteEndTime, 0); string courseName = arr[pointer + 2]; string prof = arr[pointer + 3]; string classRoom = null; string classGroup = null; if (arr[pointer + 4] != "") classGroup = arr[pointer + 4]; if (arr[pointer + 5] != "") classRoom = arr[pointer + 5]; Course c; if (classRoom != null) { c = new Course(courseName, day, startTimeSpan, endTimeSpan, classRoom); } else { c = new Course(courseName, day, startTimeSpan, endTimeSpan); } cl.Add(c); } }