How to Make Auto Updater: Visual Studios 2021

Опубликовано: 09 Октябрь 2024
на канале: Mr. Snailman (Mr.Snailman)
20,898
251

Script 1:
using System.Net;
using System.Diagnostics;

InitializeComponent();

WebClient webClient = new WebClient();

try
{
if (!webClient.DownloadString("yourpastebinlink").Contains("1.5.0"))
{
if (MessageBox.Show("Looks like there is an update! Do you want to download it?", "Demo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
using (var client = new WebClient())
{
Process.Start("UpdaterDemo.exe");
this.Close();
}
}
}
catch
{

}

Script 2:
using System.Net;
using System.IO;
using System.Diagnostics;
using System.IO.Compression;


InitializeComponent();

WebClient webClient = new WebClient();
var client = new WebClient();

try
{
System.Threading.Thread.Sleep(5000);
File.Delete(@".\Demo.exe");
client.DownloadFile("yourfilelink", @"Demo.zip");
string zipPath = @".\Demo.zip";
string extractPath = @".\";
ZipFile.ExtractToDirectory(zipPath, extractPath);
File.Delete(@".\Demo.zip");
Process.Start(@".\Demo.exe");
this.Close();
}
catch
{
Process.Start("Demo.exe");
this.Close();
}







-----tags-----
auto updater, Visual studio auto updater, visual studio, auto updater c#, auto program updater