Exemplo n.º 1
0
        private void CheckForNewVersionAsync()
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
            var client  = new RestClient("https://api.github.com");
            var request = new RestRequest("/repos/{user}/{repo}/releases/latest", Method.GET);

            request.AddUrlSegment("user", "minze25");
            request.AddUrlSegment("repo", "minze-crate");
            var response = client.Get(request);
            var ans      = LatestRepoAnswer.FromJson(response.Content);

            if (Convert.ToDouble(ans.TagName) > this.version)
            {
                MessageBox.Show("There is a new version, please update your program for maximum compatibility");
            }
        }
Exemplo n.º 2
0
 public static string ToJson(this LatestRepoAnswer self) => JsonConvert.SerializeObject(self, Minze_Crate.Converter.Settings);