public static bool CheckforUpdate() { bool result = false; try { var request = (HttpWebRequest)WebRequest.Create(release_url); request.UserAgent = "request"; request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) { JsonData = reader.ReadToEnd(); if (JsonData != null || JsonData != "") { Build = Parse(); } if (Build != null) { CurrentVersion = GetVersionFromLog(Build.Version); } } } catch (HttpRequestException e) { Write("Http request error: {0}\nPlease make sure you have an active internet connection!", e.Message); } catch (WebException e) { Write("Http request error: {0}\nPlease make sure you have an active internet connection!", e.Message); } return(result); }
public static RPCS3 Parse() { RPCS3 _build = new RPCS3(); try { var _release = (JObject)JsonConvert.DeserializeObject(JsonData); if (_release != null) { _build.DownloadLink = _release.SelectToken("assets[0].browser_download_url").Value <string>(); _build.Version = _release.SelectToken("name").Value <string>(); _build.ReleaseTime = _release.SelectToken("published_at").Value <DateTime>(); } } catch (JsonException e) { Write("Failed to read json data: {0}", e.Message); } return(_build); }