void threadDoStuff() { var fullPath = (string)reg.GetValue(""); installPath = fullPath.Replace("ChessInstaller.exe", "").Replace("ChessClient.exe", "").Replace("ChessInstall.exe", ""); var version = new ClientVersion((string)reg.GetValue("Version")); var installer = new InstallProcess(installPath, update, percentage); var latest = new ClientVersion(installer.getLatestVersion()); string delta = ""; int compare = version.CompareTo(latest); if (compare == 0) { delta = "Up to date"; } else if (compare < 0) { delta = "Outdated"; } else { delta = "Newer"; } update($"Current: {version}\r\nLatest: {latest}\r\n{delta}"); Thread.Sleep(1500); if (compare < 0) { // remove everything update("Updating..."); Thread.Sleep(250); installer.unInstall(); Thread.Sleep(250); if (!Directory.Exists(installPath)) { Directory.CreateDirectory(installPath); } Thread.Sleep(250); installer.install(latest); installer.Complete += Installer_Complete; } else { update("Hacking NASA and the NSA..."); Thread.Sleep(2500); while (isEnteringManualVersion && manualVersion == null) { update("Waiting manual version..."); Thread.Sleep(500); } if (manualVersion != null) { update("Getting manual version: " + manualVersion.ToString()); Thread.Sleep(250); installer.unInstall(); Thread.Sleep(250); if (!Directory.Exists(installPath)) { Directory.CreateDirectory(installPath); } Thread.Sleep(250); installer.install(manualVersion); installer.Complete += Installer_Complete; } else { update($"Running latest ({latest}) no update needed"); Installer_Complete(installer, null); } } }
void uninstall() { INSTALL = new InstallProcess(txtLocation.Text, setUpdate, null); INSTALL.unInstall(); }