forked from lin-ycv/EverythingPowerToys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdate.cs
34 lines (33 loc) · 1.26 KB
/
Update.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Diagnostics;
using System.Windows;
using System.Xml;
namespace Community.PowerToys.Run.Plugin.Everything
{
internal sealed class Update
{
internal Update(Version v)
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load("https://img.shields.io/github/v/release/lin-ycv/everythingpowertoys");
Version latest = Version.Parse(doc.GetElementsByTagName("title")[0].InnerXml.Split(':', StringSplitOptions.TrimEntries)[1].AsSpan(1));
if (latest > v)
{
MessageBoxResult mbox = MessageBox.Show($"New version available for EverythingPowerToys.\n\nInstalled:\t {v}\nLatest:\t {latest}", "Download Update?", MessageBoxButton.OKCancel);
if (mbox == MessageBoxResult.OK)
{
ProcessStartInfo p = new ProcessStartInfo("https://github.com/lin-ycv/EverythingPowerToys/releases/latest")
{
UseShellExecute = true,
Verb = "Open",
};
Process.Start(p);
}
}
}
catch { }
}
}
}