Beispiel #1
0
        public static async Task FetchCanyons(string url, string path)
        {
            if (File.Exists(path))
            {
                return;
            }

            var jsonCanyons = await GetCanyons(url);

            CanyonCsvLoader.WriteCanyonsToCsv(jsonCanyons, path);
        }
        private static async Task FetchCanyons(CanyonInfoConfig config)
        {
            if (File.Exists(config.JsonPath))
            {
                return;
            }

            Directory.CreateDirectory(config.RootDirectory);
            await CanyonFetcher.FetchCanyons(config.DescentecanyonJson, config.CsvPath);

            var canyonCsvs  = CanyonCsvLoader.ReadCanyons(config.CsvPath);
            var canyonInfos = CanyonInfoFetcher.FetchCanyonInfo(canyonCsvs, config);

            CanyoninInfoJsonLoader.Save(canyonInfos, config.JsonPath);

            var canyonInfosLight = canyonInfos.Select(x => new CanyonInfoLight(x)).ToList();

            CanyoninInfoJsonLoader.Save(canyonInfosLight, config.JsonPathLight);
        }