Esempio n. 1
0
        public LessonInfoViewModel(LessonInfo lessonInfo, TimetableInfo timetableInfo)
        {
            LessonInfo         = lessonInfo;
            this.timetableInfo = timetableInfo;
            Statistics         = new(GetStatistics);

            LocalizationResourceManager.Current.PropertyChanged += (_, _) => OnPropertyChanged(nameof(Statistics));
        }
        private TimetableModel MapTimetable(TimetableInfo parsedTimetable)
        {
            var timetable = new TimetableModel();

            timetable.Key        = CreateTimetableId(parsedTimetable.Groups);
            timetable.SheetTitle = parsedTimetable.SheetTitle;
            timetable.Groups     = parsedTimetable.Groups;
            timetable.Subjects   = MapSubjects(parsedTimetable.Subjects);

            return(timetable);
        }
        public List <TimetableInfo> ParseExcelFile(string fileName)
        {
            ConsoleHelper.HorizontalLine();

            var timetables = new List <TimetableInfo>();

            using (var stream = File.Open(fileName, FileMode.Open, FileAccess.Read))
            {
                // Auto-detect format:
                // Binary Excel files (2.0-2003 format; *.xls), OpenXml Excel files (2007 format; *.xlsx)
                using (var reader = ExcelReaderFactory.CreateReader(stream))
                {
                    do
                    {
                        if (reader.VisibleState != "visible")
                        {
                            continue;
                        }

                        var timetable = new TimetableInfo()
                        {
                            SheetTitle = reader.Name,
                            Groups     = GetGroupNumbers(reader.Name),
                            Subjects   = new List <SubjectInfo>()
                        };

                        ParseHeader(reader, timetable);

                        SubjectInfo subject = null;
                        do
                        {
                            subject = ParseRowsOfSubject(reader);

                            if (subject != null)
                            {
                                timetable.Subjects.Add(subject);
                            }
                        }while (subject != null);

                        timetables.Add(timetable);
                    } while (reader.NextResult());
                }
            }

            ConsoleHelper.HorizontalLine();

            return(timetables);
        }
        private void ParseHeader(IExcelDataReader reader, TimetableInfo timetable)
        {
            const int headerHeight = 5;

            for (int currentRow = 1; currentRow <= headerHeight; currentRow++)
            {
                if (!reader.Read())
                {
                    return;
                }

                //if (!_skipThisRows.Contains(currentRow))
                //{
                //    timetable.Groups = GetGroupNumbers(reader);
                //}
            }
        }
Esempio n. 5
0
        public ResumeForm(UserSettings settings, Route route, MainForm.UserAction mainFormAction, Activity activity, TimetableInfo timetable,
                          MainForm parentForm)
        {
            MainForm       = parentForm;
            SelectedAction = mainFormAction;
            Multiplayer    = SelectedAction == MainForm.UserAction.MultiplayerClient || SelectedAction == MainForm.UserAction.MultiplayerServer;
            InitializeComponent();  // Needed so that setting StartPosition = CenterParent is respected.

            Localizer.Localize(this, catalog);

            // Windows 2000 and XP should use 8.25pt Tahoma, while Windows
            // Vista and later should use 9pt "Segoe UI". We'll use the
            // Message Box font to allow for user-customizations, though.
            Font = SystemFonts.MessageBoxFont;

            Settings  = settings;
            Route     = route;
            Activity  = activity;
            Timetable = timetable;

            checkBoxReplayPauseBeforeEnd.Checked = Settings.ReplayPauseBeforeEnd;
            numericReplayPauseBeforeEnd.Value    = Settings.ReplayPauseBeforeEndS;

            gridSaves_SelectionChanged(null, null);

            if (SelectedAction == MainForm.UserAction.SinglePlayerTimetableGame)
            {
                Text = String.Format("{0} - {1} - {2}", Text, route.Name, Path.GetFileNameWithoutExtension(Timetable.fileName));
                pathNameDataGridViewTextBoxColumn.Visible = true;
            }
            else
            {
                Text = String.Format("{0} - {1} - {2}", Text, route.Name, activity.FilePath != null ? activity.Name :
                                     activity.Name == "+ " + catalog.GetString("Explore in Activity Mode") + " +" ? catalog.GetString("Explore in Activity Mode") : catalog.GetString("Explore Route"));
                pathNameDataGridViewTextBoxColumn.Visible = activity.FilePath == null;
            }

            if (Multiplayer)
            {
                Text += " - Multiplayer ";
            }

            LoadSaves();
        }
        public ManageLessonsPage(SavedEntity savedEntity)
        {
            InitializeComponent();
            Title += $": {savedEntity.Name}";

            timetable = EventsRepository.GetTimetableLocal(savedEntity);
            if (timetable == null)
            {
                return;
            }
            List <LessonInfo> lessonInfo = timetable.LessonsInfo;

            lessons = new ObservableCollection <LessonInfo>
                      (
                timetable.Lessons()
                .Select(lesson => lessonInfo.FirstOrDefault(li => li.Lesson == lesson) ?? new LessonInfo {
                Lesson = lesson
            })
                .OrderBy(lesson => !timetable.Events.Where(e => e.Start >= DateTime.Now).Any(e => e.Lesson == lesson.Lesson))
                .ThenBy(lesson => lesson.Lesson.ShortName)
                      );
            LessonsList.ItemsSource = lessons;
            if (lessons.Count == 0)
            {
                NoSourceLayout.IsVisible = true;
            }

            MessagingCenter.Subscribe <LessonSettingsPage, LessonInfo>(this, "OneLessonSettingsChanged", (sender, newLessonSettings) =>
            {
                for (int i = 0; i < lessons.Count; i++)
                {
                    if (lessons[i].Lesson == newLessonSettings.Lesson)
                    {
                        lessons[i] = newLessonSettings;
                        lessons[i].Settings.NotifyChanged();
                        break;
                    }
                }
            });
        }
Esempio n. 7
0
        internal ResumeForm(UserSettings settings, Route route, MainForm.UserAction mainFormAction, Activity activity, TimetableInfo timeTable,
                            IEnumerable <Route> mainRoutes, ICatalog catalog)
        {
            this.catalog   = catalog;
            globalRoutes   = mainRoutes;
            SelectedAction = mainFormAction;
            multiplayer    = SelectedAction == MainForm.UserAction.MultiplayerClient || SelectedAction == MainForm.UserAction.MultiplayerServer;
            InitializeComponent();  // Needed so that setting StartPosition = CenterParent is respected.

            Localizer.Localize(this, catalog);

            this.settings  = settings;
            this.route     = route;
            this.activity  = activity;
            this.timeTable = timeTable;

            checkBoxReplayPauseBeforeEnd.Checked = settings.ReplayPauseBeforeEnd;
            numericReplayPauseBeforeEnd.Value    = settings.ReplayPauseBeforeEndS;

            GridSaves_SelectionChanged(null, null);

            if (SelectedAction == MainForm.UserAction.SinglePlayerTimetableGame)
            {
                Text += $" - {route.Name} - {Path.GetFileNameWithoutExtension(timeTable.FileName)}";
                pathNameDataGridViewTextBoxColumn.Visible = true;
            }
            else
            {
                Text += $" - { route.Name} - {(activity.GetType() == typeof(Activity) ? activity.Name : activity is ExploreThroughActivity ? catalog.GetString("Explore in Activity Mode") : catalog.GetString("Explore Route"))}";
                pathNameDataGridViewTextBoxColumn.Visible = activity.FilePath == null;
            }

            if (multiplayer)
            {
                Text += $" - {catalog.GetString("Multiplayer")} ";
            }
        }
Esempio n. 8
0
        public static async Task <List <LessonInfo> > UpdateLessonIdsAsync(TimetableInfo timetable)
        {
            try
            {
                List <Lesson> lessons          = timetable.Lessons().ToList();
                bool          areAllIdsPresent = lessons
                                                 .Select(l => timetable.GetAndAddLessonsInfo(l))
                                                 .All(li => li.DlNureInfo.LessonId != null);
                if (areAllIdsPresent)
                {
                    return(timetable.LessonsInfo);
                }

                List <FullCourse> courses = await new MoodleRepository().GetEnrolledCoursesAsync();
                foreach (var lesson in lessons)
                {
                    var lessonInfo = timetable.GetAndAddLessonsInfo(lesson);
                    if (lessonInfo.DlNureInfo.LessonId != null)
                    {
                        continue;
                    }

                    lessonInfo.DlNureInfo.LessonId = courses.Find(lesson).FirstOrDefault()?.Id;
                }

                await EventsRepository.UpdateLessonsInfo(timetable);

                return(timetable.LessonsInfo);
            }
            catch (Exception ex)
            {
                EnrichException(ex, timetable.Entity);
                ExceptionService.LogException(ex);
                return(timetable.LessonsInfo);
            }
        }
        private void UpdateEvents(SavedEntity selectedEntity)
        {
            if (selectedEntity == null)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Title = LN.AppName;
                });
                TimetableLayout.IsVisible = false;
                NoSourceLayout.IsVisible  = true;
                return;
            }
            else
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Title = selectedEntity.Name;
                });
                NoSourceLayout.IsVisible  = false;
                TimetableLayout.IsVisible = true;
            }

            lock (enumeratingEvents)
            {
                timetableInfo = EventsRepository.GetEvents(selectedEntity) ?? new TimetableInfo();
                if (ApplyHiddingSettings)
                {
                    timetableInfo.ApplyLessonSettings();
                }
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                if (timetableInfo.Count == 0)
                {
                    Timetable.DataSource = null;
                }
                else
                {
                    int retriesLeft     = 25;
                    Exception exception = null;
                    do
                    {
                        try
                        {
                            lock (enumeratingEvents)
                            {
                                Timetable.MinDisplayDate = timetableInfo.StartDate();
                                Timetable.MaxDisplayDate = timetableInfo.EndDate();

                                Timetable.WeekViewSettings.StartHour = 0;
                                Timetable.WeekViewSettings.EndHour   = 24;
                                Timetable.WeekViewSettings.StartHour = timetableInfo.StartTime().TotalHours;
                                Timetable.WeekViewSettings.EndHour   = timetableInfo.EndTime().TotalHours + (Timetable.TimeInterval / 60 / 2);

                                Timetable.DayViewSettings.StartHour = 0;
                                Timetable.DayViewSettings.EndHour   = 24;
                                Timetable.DayViewSettings.StartHour = timetableInfo.StartTime().TotalHours;
                                Timetable.DayViewSettings.EndHour   = timetableInfo.EndTime().TotalHours + (Timetable.TimeInterval / 60 / 2);
                            }

                            UpdateTimetableHeight();

                            // Fix for bug when view header isn`t updating on first swipe
                            try
                            {
                                Timetable.VisibleDatesChangedEvent -= Timetable_VisibleDatesChangedEvent;

                                DateTime currebtDate = visibleDates.Count > 0 ? visibleDates[0] : DateTime.Now;
                                Timetable.NavigateTo(currebtDate.AddDays(7));
                                Timetable.NavigateTo(currebtDate);
                            }
                            catch { }
                            finally
                            {
                                Timetable.VisibleDatesChangedEvent += Timetable_VisibleDatesChangedEvent;
                            }

                            Timetable.DataSource = timetableInfo.Events.Select(ev => new EventViewModel(ev)).ToList();

                            UpdateTimeLeft();
                            break;
                        }
                        catch (Exception ex)
                        {
                            // Potential error with the SfSchedule control. Needs investigation!
                            exception = ex;
                        }

                        retriesLeft--;
                    } while (retriesLeft > 0);
                    if (retriesLeft == 0 && exception != null)
                    {
                        MessagingCenter.Send(Application.Current, MessageTypes.ExceptionOccurred, exception);

                        DisplayAlert(LN.TimetableDisplay, LN.TimetableDisplayError, LN.Ok);
                        return;
                    }
                }
            });
        }
Esempio n. 10
0
        public static List <TimetableInfo> GetTimetableFromCist(DateTime dateStart, DateTime dateEnd, params Group[] groups)
        {
            List <Group> groupsAllowed = groups.ToList(); //SettingsDataStore.CheckCistTimetableUpdateRights(groups);

            using (var client = new WebClient())
            {
                client.Encoding = Encoding.GetEncoding("Windows-1251");
                try
                {
                    List <TimetableInfo> timetables = new List <TimetableInfo>(); //GetTimetableLocal(groupsAllowed.ToArray());

                    // Getting events
                    Uri    uri  = new Uri(Urls.CistGroupTimetableUrl(Urls.CistTimetableFormat.Csv, dateStart, dateEnd, groupsAllowed.Select(g => g.ID).ToArray()));
                    string data = client.DownloadString(uri);
                    Dictionary <string, List <Event> > newEvents = ParseCistCsvTimetable(data, groupsAllowed.Count > 1);
                    if (newEvents == null)
                    {
                        // Parsing error
                        return(null);
                    }

                    // Updating events and adding new timetables
                    foreach (var group in groupsAllowed)
                    {
                        var groupEvents = new List <Event>();
                        if (newEvents.Keys.Contains(group.Name))
                        {
                            groupEvents = newEvents[group.Name];
                        }
                        else if (groupsAllowed.Count == 1 && newEvents.Count == 1)
                        {
                            groupEvents = newEvents.Values.First();
                        }
                        TimetableInfo groupTimetable = timetables.FirstOrDefault(tt => tt.Group.ID == group.ID);
                        if (groupTimetable == null)
                        {
                            groupTimetable = new TimetableInfo(group);
                            timetables.Add(groupTimetable);
                        }
                        groupTimetable.Events = groupEvents;
                    }

                    // Updating lesson info if needed
                    List <Group> groupsLessonInfoAllowed = groupsAllowed; //SettingsDataStore.CheckCistLessonsInfoUpdateRights(groupsAllowed.ToArray());
                    if (groupsLessonInfoAllowed.Count > 0)
                    {
                        uri  = new Uri(Urls.CistGroupTimetableUrl(Urls.CistTimetableFormat.Xls, DateTime.Now, dateEnd, groupsLessonInfoAllowed.Select(g => g.ID).ToArray()));
                        data = client.DownloadString(uri);
                        Dictionary <string, List <LessonInfo> > groupsLessons = ParseCistXlsLessonInfo(data, groupsLessonInfoAllowed.ToArray());
                        if (groupsLessons != null)
                        {
                            foreach (var group in groupsLessonInfoAllowed)
                            {
                                TimetableInfo timetable = timetables.First(tt => tt.Group.ID == group.ID);
                                // Updating lesson info excluding lesson settings
                                foreach (var newLessonInfo in groupsLessons[group.Name])
                                {
                                    LessonInfo oldLessonInfo = timetable.LessonsInfo.FirstOrDefault(li => li.ShortName == newLessonInfo.ShortName);
                                    if (oldLessonInfo == null)
                                    {
                                        oldLessonInfo = new LessonInfo();
                                        timetable.LessonsInfo.Add(oldLessonInfo);
                                    }
                                    oldLessonInfo.ShortName      = newLessonInfo.ShortName;
                                    oldLessonInfo.LongName       = newLessonInfo.LongName;
                                    oldLessonInfo.EventTypesInfo = newLessonInfo.EventTypesInfo;
                                    oldLessonInfo.LastUpdated    = DateTime.Now;
                                }
                            }
                        }
                    }

                    // Updating LastUpdated for saved groups
                    //List<SavedGroup> AllSavedGroups = GroupsDataStore.GetSaved();
                    //foreach (var group in AllSavedGroups)
                    //{
                    //    if (groupsAllowed.Exists(g => g.ID == group.ID))
                    //    {
                    //        group.LastUpdated = DateTime.Now;
                    //    }
                    //}
                    //GroupsDataStore.UpdateSaved(AllSavedGroups);

                    // Saving timetables
                    //foreach (var newTimetable in timetables)
                    //{
                    //    UpdateTimetableLocal(newTimetable);
                    //    MessagingCenter.Send(Application.Current, MessageTypes.TimetableUpdated, newTimetable.Group.ID);
                    //}

                    return(timetables);
                }
                catch (Exception)
                {
                    //ExceptionService.LogException(ex);
                }
            }
            return(null);
        }
Esempio n. 11
0
        // GET: /<controller>/
        public async Task <IActionResult> Index()
        {
            string user = Request.Cookies["Username"];
            string pass = Request.Cookies["Password"];

            if (string.IsNullOrEmpty(user))
            {
                return(Redirect("/Login/"));
            }
            var htmlDoc = new HtmlDocument();
            var uri     = new Uri($"https://schoolapps2.tvdsb.ca/students/student_login/lgn.aspx?__EVENTTARGET&__EVENTARGUMENT&__VIEWSTATE=%2FwEPDwULLTE2MDk1ODI3MTFkZMUq3L2kXLCgWE%2BxPNKGiR2aDkz5&__VIEWSTATEGENERATOR=00958D10&__EVENTVALIDATION=%2FwEWBALO%2BPagDALT8dy8BQKd%2B7qdDgLCi9reA9VqLcMs82KsM9lnbdFM5U4r7vSJ&txtUserID={user}&txtPwd={pass}&btnSubmit=Login");

            var z = await GetLocation(uri.ToString());

            var x = await GetCookies(z);

            Response.Cookies.Append("Token", x[0].Value);

            WebRequest webRequest = WebRequest.Create("https://schoolapps2.tvdsb.ca/students/portal_secondary/student_Info/timetable2.asp");

            foreach (var cookie in x)
            {
                webRequest.TryAddCookie(new Cookie(cookie.Name, cookie.Value, "/", "schoolapps2.tvdsb.ca"));
            }
            HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
            var             encoding = ASCIIEncoding.ASCII;
            string          responseText;

            using (var reader = new System.IO.StreamReader(response.GetResponseStream(), encoding))
            {
                responseText = reader.ReadToEnd();
            }
            htmlDoc.LoadHtml(responseText);
            var          elem1       = htmlDoc.DocumentNode.Descendants("body").FirstOrDefault();
            var          index       = elem1.Descendants("table").ToList().IndexOf(elem1.Descendants("table").FirstOrDefault(t => t.InnerText.Contains("Semester:&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;Term:&nbsp;&nbsp;1")));
            var          elem2       = elem1.Descendants("table").ElementAt(index + 1);
            var          elem3       = elem2.Descendants("tr");
            var          classes     = elem2.Descendants("td").Where(t => t.InnerText.Contains("- RM."));
            List <Class> classesList = new List <Class>();

            for (int i = 0; i < classes.ToList().Count; i++)
            {
                classesList.Add(Class.parse(classes.ElementAt(i).InnerText));
                var periods = classes.ElementAt(i).ParentNode.ChildNodes.Where(t => t.InnerText.Contains("Period:"));
                if (periods.FirstOrDefault().InnerText.Contains("RM."))
                {
                    classesList[i].Period = "0";
                }
                else
                {
                    classesList[i].Period = periods.FirstOrDefault().InnerText.Split(";")[1].Substring(0, 1);
                    if (periods.FirstOrDefault().InnerText.Contains("HR"))
                    {
                        classesList[i].isHomeRoom = true;
                    }
                }
            }
            int classesListSize = classesList.Count;

            for (int i = 1; i < classesListSize; i++)
            {
                int currentPeriod = int.Parse(classesList[i].Period);
                int lastPeriod    = int.Parse(classesList[i - 1].Period);
                if (currentPeriod == 4)
                {
                    if (currentPeriod != lastPeriod + 2 && currentPeriod != lastPeriod)
                    {
                        classesList.Add(new Class()
                        {
                            ClassCode = "Spare",
                            Period    = (currentPeriod - 2).ToString(),
                            ClassRoom = "",
                            Teacher   = ""
                        });
                    }
                }
                else
                {
                    if (currentPeriod != lastPeriod + 1 && currentPeriod != lastPeriod)
                    {
                        classesList.Add(new Class()
                        {
                            ClassCode = "Spare",
                            Period    = (currentPeriod - 1).ToString(),
                            ClassRoom = "",
                            Teacher   = ""
                        });
                    }
                }
            }
            classesList = classesList.OrderBy(t => int.Parse(t.Period)).ToList();
            var           studentinfo = htmlDoc.DocumentNode.Descendants("body").FirstOrDefault().Descendants("table").ElementAt(1).Descendants("tr").ElementAt(0).Descendants("td");
            TimetableInfo tbi         = new TimetableInfo();

            tbi.FirstName  = studentinfo.ElementAt(0).ChildNodes[0].InnerText.Split(",").LastOrDefault().Trim();
            tbi.LastName   = studentinfo.ElementAt(0).ChildNodes[0].InnerText.Split(",").FirstOrDefault().Trim();
            tbi.StudentNum = htmlDoc.DocumentNode.Descendants("td").FirstOrDefault(t => t.InnerText.Contains("Student#")).InnerText.Split(" ")[2].Substring(0, 9);
            tbi.OenNum     = htmlDoc.DocumentNode.Descendants("td").FirstOrDefault(t => t.InnerText.Contains("Student#")).InnerText.Split(" ").LastOrDefault();
            tbi.Grade      = htmlDoc.DocumentNode.Descendants("td").FirstOrDefault(t => t.InnerText.Contains("Grade: ")).InnerText.Split(" ").LastOrDefault();
            tbi.LockNum    = htmlDoc.DocumentNode.Descendants("td").FirstOrDefault(t => t.InnerText.Contains("Locker #: ")).InnerText.Split(" ").LastOrDefault();
            tbi.Classes    = classesList;
            return(View(model: tbi));
        }
Esempio n. 12
0
        public static Timetable ParseTimetableFiles(IEnumerable <string> filesContents, DateTime date)
        {
            string[]  dni       = { "PN", "WT", "ŚR", "CZW", "PT", "SO", "NIE" };
            Timetable timetable = new Timetable()
            {
                Date = date
            };

            foreach (var content in filesContents)
            {
                var lines = Regex.Split(content, Environment.NewLine);
                Dictionary <string, string> groups  = new Dictionary <string, string>();
                Dictionary <string, string> degrees = TimetableOLD.Models.Dictionaries.DegreesDictionary2;
                TimetableInfo currentInfo           = new TimetableInfo();
                for (int i = 0; i < lines.Length; i++)
                {
                    if (lines[i].ToUpper().Trim() == "GROUPS")
                    {
                        string[] grs = lines.Skip(i + 1).TakeWhile(l => l.ToLower().Trim() != "end_groups.").ToArray();
                        foreach (var gr in grs)
                        {
                            string[] g = gr.Split(';');
                            if (!groups.ContainsKey(g[0].Trim()))
                            {
                                groups.Add(g[0].Trim(), g.Length > 1 ? g[1].Trim() : "");
                            }
                        }
                        i += grs.Length + 1;
                    }
                    else if (lines[i].ToUpper().Trim() == "INFO")
                    {
                        string[] infoLines = lines.Skip(i + 1).TakeWhile(l => l.ToLower().Trim() != "end_info.").ToArray();
                        string[] infos     = infoLines[0].Split(';');
                        currentInfo = new TimetableInfo()
                        {
                            AcademicYear = infos[0].Trim(),
                            Department   = infos[1].Trim(),
                            Mode         = infos[2].Trim(),
                            Field        = infos[3].Trim(),
                            Degree       = degrees.ContainsKey(infos[4].Trim().ToUpper()) ? degrees[infos[4].Trim().ToUpper()] : infos[4].Trim(),
                            Semester     = Convert.ToInt32(infos[5].Trim()),
                            Year         = Convert.ToInt32(infos[6].Trim()),
                        };
                        i += infoLines.Length + 1;
                    }
                    else if (dni.Contains(lines[i].ToUpper().Trim()))
                    {
                        DayOfWeek day = 0;
                        for (int j = 0; j < dni.Length; j++)
                        {
                            if (lines[i].ToUpper().Trim() == dni[j])
                            {
                                day = (DayOfWeek)j;
                            }
                        }

                        string[] dayLines = lines.Skip(i + 1).TakeWhile(l => l.ToLower().Trim() != "end_day.").ToArray();
                        for (int j = 0; j < dayLines.Length;)
                        {
                            string[]      eventLines = lines.Skip(i + j + 1).TakeWhile(l => l.ToLower().Trim() != "end_event.").ToArray();
                            string        name, type, room, building, remarks;
                            List <string> lecturers = new List <string>(), facultyGroups = new List <string>();
                            List <string> groupsNrs = new List <string>();
                            DateTime      startTime, endTime;
                            name = eventLines[0].Split(';')[0].Trim();
                            try
                            {
                                type = eventLines[0].Split(';')[1].Trim();
                            }
                            catch (Exception ex)
                            {
                                type = "?";
                            }
                            //TODO: add facultygroups
                            foreach (string s in eventLines[1].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                groupsNrs.Add(s.Trim());
                            }
                            List <TimetableGroup> eventGroups = new List <TimetableGroup>();
                            foreach (var item in groupsNrs)
                            {
                                eventGroups.Add(new TimetableGroup()
                                {
                                    Group = item, Specialization = groups.ContainsKey(item) ? groups[item] : ""
                                });
                            }

                            startTime = DateTime.ParseExact(eventLines[2].Split('-')[0], new[] { "HH:mm", "H:mm" }, null, DateTimeStyles.AllowWhiteSpaces);
                            endTime   = DateTime.ParseExact(eventLines[2].Split('-')[1], new[] { "HH:mm", "H:mm" }, null, DateTimeStyles.AllowWhiteSpaces);

                            string[] where = eventLines[3].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                            room           = where.Length > 0 ? where[0].Trim() : "";
                            building       = where.Length > 1 ? where[1].Trim() : "";

                            foreach (string l in eventLines[4].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                lecturers.Add(l.Trim());
                            }

                            remarks = eventLines[5].Trim();

                            TimetableEvent ev = new TimetableEvent()
                            {
                                Name          = name,
                                Type          = type,
                                Groups        = eventGroups,
                                FacultyGroups = new List <string>(),
                                StartTime     = startTime,
                                EndTime       = endTime,
                                Room          = room,
                                Building      = building,
                                Lecturers     = lecturers,
                                Remarks       = remarks
                            };

                            TimetableAcademicYear k = MakeTimetableAcademicYear(currentInfo.AcademicYear, currentInfo.Department, currentInfo.Mode, currentInfo.Field, currentInfo.Semester, currentInfo.Degree, currentInfo.Year, day, ev);

                            MergeToTimetable(timetable, k);


                            j += eventLines.Length + 1;
                        }
                    }
                }
            }

            //sorting all events
            SortTimetable(timetable);

            return(timetable);
        }