private async Task <VersionManifest> GetManifestAsync() { if (_manifest != null) { return(_manifest); } using var httpClient = new HttpClient(); try { var versionManifestJson = await httpClient.GetStringAsync( VersionManifestUri.Replace("{ts}", DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString())); var versionManifest = VersionManifest.FromJson(versionManifestJson); _manifest = versionManifest; return(_manifest); } catch (Exception ex) { Log.Error(ex, "Failed to fetch latest MCJava version manifest."); throw; } }
public static string ToJson(this VersionManifest self) => JsonConvert.SerializeObject(self, VersionManifestConverter.Settings);