public Task <VersionManifestDefinition> GetVersion(MCVersion v) { if (v.Url == null) { throw new MCDownloadException("Version doesn't have any URL"); } return(MCHttpHelper.Get <VersionManifestDefinition>(v.Url)); }
private async Task <VersionManifest> loadManif(MCVersion v) { VersionManifestDefinition def = await resolver.GetVersion(v); if (def.JarFrom != null) { await getManifestFor(GetRemoteVersion(def.JarFrom)); } if (def.InheritsFrom != null) { await getManifestFor(GetRemoteVersion(def.InheritsFrom)); } return(new VersionManifest(def, this)); }
public async Task <VersionManifestDefinition> GetVersion(MCVersion v) { foreach (IVersionResolver resolver in stack) { try { return(await resolver.GetVersion(v)); } catch (MCDownloadException) { // Couldn't get version, continuing to next resolver } } throw new MCDownloadException("Could not find version \"" + v + "\""); }
internal Task <VersionManifest> getManifestFor(MCVersion v) { return(manifestCache.GetOrAdd(v.ID, new Lazy <Task <VersionManifest> >(() => loadManif(v), true)).Value); }
// Only call if you know it is loaded (e.g. InheritsFrom or JarFrom) private VersionManifest getLoadedVersionManifest(MCVersion v) { return(downloader.getManifestFor(v).GetAwaiter().GetResult()); }