コード例 #1
0
 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));
 }
コード例 #2
0
        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));
        }
コード例 #3
0
 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 + "\"");
 }
コード例 #4
0
 internal Task <VersionManifest> getManifestFor(MCVersion v)
 {
     return(manifestCache.GetOrAdd(v.ID, new Lazy <Task <VersionManifest> >(() => loadManif(v), true)).Value);
 }
コード例 #5
0
 // Only call if you know it is loaded (e.g. InheritsFrom or JarFrom)
 private VersionManifest getLoadedVersionManifest(MCVersion v)
 {
     return(downloader.getManifestFor(v).GetAwaiter().GetResult());
 }