Exemple #1
0
        private static async ValueTask <IHtmlDocument> GetStopAngleSharpDocumentAsync(BusStop busStop)
        {
            string urlOfBusStop = $"{_TIMETABLE_BASE_URL}{busStop.Url}";
            var    document     = await GetAngleSharpDocumentOfSiteAsync(urlOfBusStop);

            return(document);
        }
Exemple #2
0
 private static bool IsStopFirstStopInTrack(Track track, BusStop busStop)
 => track.Name != busStop.Name;
Exemple #3
0
        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);
        }