Пример #1
0
        private List <Flight> ExtractData(string sector)
        {
            List <Flight> collectedDataList = new List <Flight>();

            string[] sectorOriginAndDestination = Regexes.RegexToStringArray(sector, Regexes.SectorOriginAndDestination);
            string[] sectorsInfo = Regexes.RegexToStringArray(sector, Regexes.SectorInfo);
            foreach (string sectorInfo in sectorsInfo)
            {
                Flight flight = new Flight(sectorOriginAndDestination, sectorInfo);
                collectedDataList.Add(flight);
            }

            return(collectedDataList);
        }
Пример #2
0
        public List <Combinations> Start(string searchCriteria)
        {
            List <Flight> tempList = new List <Flight>();

            ExtractSearchCriterias(searchCriteria);
            string content = TryLoadPage();

            string[] bounds = Regexes.RegexToStringArray(content, Regexes.Bounds);

            string[] outboundSectors = Regexes.RegexToStringArray(bounds[0], Regexes.Sectors);
            foreach (string outboundSector in outboundSectors)
            {
                tempList = ExtractData(outboundSector);
                outboundData.AddRange(tempList);
            }

            if (_afo.IsRt)
            {
                string[] inboundSectors = Regexes.RegexToStringArray(bounds[1], Regexes.Sectors);

                foreach (string inboundSector in inboundSectors)
                {
                    tempList = ExtractData(inboundSector);
                    inboundData.AddRange(tempList);
                }
            }


            foreach (Flight outbound in outboundData)
            {
                if (_afo.IsRt)
                {
                    foreach (Flight inbound in inboundData)
                    {
                        Combinations combinations = new Combinations(outbound, inbound);
                        combinationsList.Add(combinations);
                    }
                }
                else
                {
                    Combinations combinations = new Combinations(outbound);
                    combinationsList.Add(combinations);
                }
            }

            return(combinationsList);
        }