public static string GetLatestUrl() { try { VanillaDownload download = GetDownloadFromId( GetLatestVersion(), VanillaDownloadType.snapshot); return(GetVanillaDownloadURL(download)); } catch (Exception e) { Logger.Log(LogLevel.Warning, "VanillaDownloadProvider", "Failed to retrieve latest vanilla version URL", e.Message); // Why isn't this string null or empty? // If address has invalid format, WebUtil crashes BukkitGui // This is a little workarround // https://0.0.0.0 leads to "void", but it doesn't crash BG return("https://0.0.0.0"); } }
public VanillaDownloadInfo(string json) { JsonObject obj = JsonConvert.Import<JsonObject>(json); try { Versions = new List<VanillaDownload>(); Latest = new VanillaDownload(obj["latest"].ToString()); foreach (JsonObject entry in (JsonArray) obj["versions"]) { Versions.Add(new VanillaDownload(entry.ToString())); } } catch (Exception e) { Logger.Log(LogLevel.Warning, "VanillaDownloadProvider", "Failed to parse downloadInfo", e.Message); } }