My exit code is only returning 0 even when an update is available. The wyUpdater.exe sees that there is an update, but when running the command lines it returns 0. Here is my code:
public void checkForUpdate()
{
//This searches for the wyUpdate.exe in the project folder. It should not have to be hard coded because of this now.
//Un-comment this when running through Visual Studio
string projectPath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
//Comment this out when running through Visual Studio
//string projectPath = "C:\\Program Files (x86)\\Anonymous Alerts, LLC\\Smart Button Desktop";
string path = Path.Combine(projectPath, "wyUpdate", "wyUpdate.exe");
Console.WriteLine("BlueBeetle: " + @path);
//This is the working one (Hard Coded Path)
//var num = Process.Start(@"C:\Users\licen\OneDrive\Desktop\SB_Desktop_v.2.8 wyUpdater Test Copy\DSUalerts\wyUpdate\wyUpdate.exe", "/quickcheck /justcheck /noerr");
//
//This runs a command through wyUpdate to check if an update is needed. 0 = no update, 1 = there was an error, 2 = there is an update
var num = Process.Start(@path, "start /wait wyUpdate.exe /quickcheck /justcheck /noerr ");
//var num = Process.Start(@path, "start /wait wyUpdate.exe /quickcheck");
Console.WriteLine("GreenGiraffe: " + "wyUpdate.exe started");
num.WaitForExit();
Console.WriteLine("GreenGiraffe: " + "wyUpdate.exe exited, ExitCode: " + num.ExitCode.ToString());
num.WaitForExit();
if (num.ExitCode == 2)
{
ReadyToBeInstalled();
}
else if (num.ExitCode == 1)
{
automaticUpdater1.Visible = false;
helpTextView.Visible = true;
helpTextView.Text = "There was an error with the installation.";
System.Threading.Thread.Sleep(5000);
checkForUpdate();
}
else if(num.ExitCode == 0)
{
automaticUpdater1.Visible = false;
helpTextView.Visible = true;
helpTextView.Text = "There are no updates to be installed.";
}
}