So I want to create a really simple function. When the form loads, a message box pops up to prompt user to upgrade. If Yes is clicked, it downloads a txt file with latest version and information on where to download the latest program. If the version is higher, it download the actual update. But if equal, just cancels It's really simple but I cant find an answer for it anywhere :(
Here was my previous approach:
WebRequest wr = WebRequest.Create(new Uri("https://pastebin.com"));
WebResponse ws = wr.GetResponse();
StreamReader sr = new StreamReader(ws.GetResponseStream());
string currentversion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string newversion = sr.ReadToEnd();
if (currentversion.Contains(newversion))
{
System.Windows.Forms.MessageBox.Show("You Program is Up-to-Date", "Information",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
System.Windows.Forms.MessageBox.Show("A new Version of the Program was detected! The program will now update to give you the latest features!", "Important",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
Process.Start("cmd.exe", "/C ping 1.1.1.1 -n 1 -w 3000 > Nul & Del " +
Application.ExecutablePath);
Application.Exit();