public async static Task <byte[]> GetFile(string buildConfig, string cdnConfig, string contenthash) { var foundTarget = false; var contenthashMD5 = contenthash.ToByteArray().ToMD5(); if (!NGDP.encodingDictionary.TryGetValue(contenthashMD5, out MD5Hash target)) { Logger.WriteLine("Contenthash " + contenthash + " not found in encoding, loading build " + buildConfig + ".."); await BuildCache.GetOrCreate(buildConfig, cdnConfig); if (NGDP.encodingDictionary.TryGetValue(contenthashMD5, out target)) { foundTarget = true; } // Remove build from cache, all encoding entries will be in encodingDictionary now for future reference BuildCache.Remove(buildConfig); } else { foundTarget = true; } if (!foundTarget) { throw new FileNotFoundException("Unable to find contenthash " + contenthash + " in encoding!"); } return(await RetrieveFileBytes(target)); }