public static async void CheckForNewVersion(Window wnd) { //Builtin only exists during building, your IDE may complain DateTime compileTime = new DateTime(Builtin.CompileTime, DateTimeKind.Utc); try { using (var handler = new HttpClientHandler()) { handler.UseDefaultCredentials = true; using (HttpClient client = new HttpClient(handler)) { HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, "https://api.github.com/repos/RatchetModding/Replanetizer/releases/latest"); //Github wants a user agent, otherwise it returns code 403 Forbidden requestMessage.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"); HttpResponseMessage response = await client.SendAsync(requestMessage); response.EnsureSuccessStatusCode(); string content = await response.Content.ReadAsStringAsync(); JObject?data = (JObject?)Newtonsoft.Json.JsonConvert.DeserializeObject(content); if (data != null) { string?time = (string?)data["created_at"]; string?url = (string?)data["html_url"]; string?newestReleaseTag = (string?)data["tag_name"]; if (time != null) { CultureInfo cultureInfo = new CultureInfo("en-US"); DateTime currVersionDate = DateTime.Parse(time, cultureInfo); if (currVersionDate.CompareTo(compileTime.AddHours(6.0)) > 0) { UpdateInfoFrame frame = new UpdateInfoFrame(wnd, url, compileTime, currVersionDate, newestReleaseTag); wnd.AddFrame(frame); } } } } } } catch (Exception e) { LOGGER.Warn("Failed to check for new version. Error: " + e.Message); } }