using System; using System.Net; using System.Linq; using System.Threading; using System.Diagnostics; using System.Windows.Forms; using System.ComponentModel; namespace Launcher_SelfUpdater { public partial class Main : Form { public Main() { Text = String.Format("{0} Self Updater", Properties.Settings.Default.Name); InitializeComponent(); } private void Main_Load(Object Sender, EventArgs Arguments) { new Thread(() => { while (Process.GetProcesses().FirstOrDefault(Name => Name.ProcessName == Properties.Settings.Default.Launcher_Name.Split('.')[0]) != null) { Thread.Sleep(1000); } WebClient DownloadLauncher = new WebClient(); DownloadLauncher.DownloadFileCompleted += DownloadLauncher_Completed; DownloadLauncher.DownloadFileAsync(new Uri(""), Properties.Settings.Default.Launcher_Name); }).Start(); } private void DownloadLauncher_Completed(Object Sender, AsyncCompletedEventArgs Arguments) { Process.Start(Properties.Settings.Default.Launcher_Name); Environment.Exit(-1); } } }