public Task <AssetGroupIndexDefinition> GetAssetIndex(AssetGroup ag) { if (ag.DescribedBy.Url == null) { throw new MCDownloadException("Asset group doesn't have any url."); } return(MCHttpHelper.Get <AssetGroupIndexDefinition>(ag.DescribedBy.Url)); }
public async Task <AssetGroupIndexDefinition> GetAssetIndex(AssetGroup ag) { foreach (IVersionResolver resolver in stack) { try { return(await resolver.GetAssetIndex(ag)); } catch (MCDownloadException) { // Couldn't get version, continuing to next resolver } } throw new MCDownloadException("Could not find asset index \"" + ag.ID + "\""); }
private async Task <AssetGroupIndex> loadAIndex(AssetGroup a) { AssetGroupIndexDefinition def = await resolver.GetAssetIndex(a); return(new AssetGroupIndex(def)); }
internal Task <AssetGroupIndex> getAIndexFor(AssetGroup a) { return(aIndexCache.GetOrAdd(a.ID, new Lazy <Task <AssetGroupIndex> >(() => loadAIndex(a), true)).Value); }