WebView2Utilities
WebView2Utilities copied to clipboard
Easy update to newer versions
Make it as easy as possible to update to the newest version of the tool. Possible solutions:
- Have a button for updating to the latest
- Make the tool check if it is the latest version and suggest to the user to update
The key code looks like this
string owner = "david-risney" +
""; // Replace with the repository owner
string repo = "WebView2Utilities"; // Replace with the repository name
string url = $"https://api.github.com/repos/{owner}/{repo}/releases";
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
client.DefaultRequestHeaders.Add("User-Agent", ".NET Foundation Repository Reporter");
//client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "YOUR_PERSONAL_ACCESS_TOKEN");
var response = client.GetStringAsync(url).Result;
var releases = JsonSerializer.Deserialize<Release>(response);
//using (
//)
//{
// JsonElement root = doc.RootElement;
// string name = root.GetProperty("name").GetString();
// int stars = root.GetProperty("stargazers_count").GetInt32();
// Console.WriteLine($"Repository: {name}, Stars: {stars}");
//}