Beispiel #1
0
        /// <summary>
        /// Gets the Requested POI file from the POIGraves site
        /// </summary>
        /// <param name="log">Logger Instance</param>
        /// <param name="category">Category to be loaded</param>
        /// <returns>Populated Category</returns>
        private static PointOfInterestCategory GetFromPoiGraves(ILogger log, CategoryEnum category)
        {
            log.LogInformation($"POIs - Category = {category}");
            PointOfInterestCategory currentCategory = new PointOfInterestCategory((int)category, category.ToDescriptionString(), null);

            byte[] categoryZip = POIs.Download(category);
            log.LogInformation($"POIs - Zip Size = {categoryZip.Length}");
            string categoryCsv = POIs.Unpack(categoryZip);

            log.LogInformation($"POIs - CSV Size = {categoryCsv.Length}");
            currentCategory.Items.AddRange(POIs.ProcessCsv(categoryCsv));
            log.LogInformation($"POIs - Line Count = {currentCategory.Items.Count}");
            return(currentCategory);
        }
Beispiel #2
0
        /// <summary>
        /// Get the Latest RSBP Reserves file
        /// </summary>
        /// <param name="log">Logger Instance</param>
        /// <returns>Category complete with reserves</returns>
        private static PointOfInterestCategory GetRSBPReserves(ILogger log)
        {
            log.LogInformation("POIs - Category = RSPB Reserves");
            PointOfInterestCategory rspbReserves = new PointOfInterestCategory((int)CategoryEnum.RSPBReserves, CategoryEnum.RSPBReserves.ToDescriptionString(), null);

            WebClient client = new WebClient();

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            string reservesCsv = client.DownloadString("https://www.rspb.org.uk/globalassets/downloads/documents/reserves/csv-data-file---reserves.csv");

            log.LogInformation($"POIs - CSV Size = {reservesCsv.Length}");

            rspbReserves.Items.AddRange(POIs.ProcessCsv(reservesCsv));
            log.LogInformation($"POIs - Line Count = {rspbReserves.Items.Count}");
            return(rspbReserves);
        }