/// <summary> /// Create a Item Set JSON file for all champions under LoL install path /// </summary> /// <param name="cancelToken"></param> /// <returns>List of failed champion item sets</returns> public async Task <List <ChampionViewModel> > GenerateItemSetForAllChampionsAsync(CancellationToken cancelToken = default) { LoLStore loLStore = await StoreManager <LoLStore> .GetAsync(); List <ChampionViewModel> champions = loLStore.Champions; string startingLog = LoggerUtil.FormatLogByBuildSource(BuildSourceName, "Start downloading item sets..."); LogHandler(startingLog); // Store the failed champions to return later List <ChampionViewModel> failedChampions = new List <ChampionViewModel>(); // Parallel downloads await champions.ParallelForEachAsync(async (champion, index) => { bool success = await TryGenerateItemSetByChampion(champion, cancelToken); if (!success) { failedChampions.Add(champion); } double progress = (double)(index + 1) / champions.Count; UpdateProgressHandler(progress * 100); }, maxDegreeOfParallelism : MAX_CONNECTIONS_PER_DOMAIN, cancellationToken : cancelToken); LogHandler(LoggerUtil.FormatLogByBuildSource(BuildSourceName, "Finished")); return(failedChampions); }
public async Task InitAsync_LoLStore_IsInitialized() { LoLStore lolStore = await StoreManager <LoLStore> .GetAsync(); Assert.NotNull(lolStore.BaseUrlAPI); Assert.NotNull(lolStore.Version); Assert.True(lolStore.Champions.Count > 0); Assert.True(lolStore.Items.Count > 0); }