private static async ValueTask <IHtmlDocument> GetStopAngleSharpDocumentAsync(BusStop busStop) { string urlOfBusStop = $"{_TIMETABLE_BASE_URL}{busStop.Url}"; var document = await GetAngleSharpDocumentOfSiteAsync(urlOfBusStop); return(document); }
private static bool IsStopFirstStopInTrack(Track track, BusStop busStop) => track.Name != busStop.Name;
private static List <Hour> GetHoursListFromHtmlList(IHtmlDocument htmlDocument, IEnumerable <IElement> listOfHtmlHours, BusStop busStom) { IEnumerable <IElement> listOfDaysType = listOfHtmlHours.Where((p, i) => i % 2 == 0); IEnumerable <IElement> listWithHoursOfDaysType = listOfHtmlHours.Where((p, i) => i % 2 == 1); List <Hour> listOfHours = new List <Hour>(); int daysTypeCount = listOfDaysType.Count(); for (int i = 0; i < daysTypeCount; i++) { IElement htmlDayType = listOfDaysType.ElementAt(i); var hour = new Hour() { Id = _HourId++, IdOfBusStop = busStom.Id }; string hourName = htmlDayType.FirstElementChild.TextContent; hour = SetHourName(hour, hourName); hour = GetHoursFromDayType(hour, listWithHoursOfDaysType.ElementAt(i), htmlDocument); if (hour == null) { return(null); } listOfHours.Add(hour); } return(listOfHours); }