Fixes for Auto Update (#1908)

* Automatically restart audio capture when device changes.

* Wait for process to terminate instead of waiting a fixed amount of time.

* Application.Exit might not exit if there is a child process running. Environment.Exit(0) do though.
This commit is contained in:
IceStormNG
2024-01-13 11:38:37 +01:00
committed by GitHub
parent 556a4ce4ee
commit 772bd8e7a5

View File

@@ -120,7 +120,7 @@ namespace GHelper.AutoUpdate
Logger.WriteLine(zipName);
Logger.WriteLine(exeName);
string command = $"Start-Sleep -Seconds 1; $ErrorActionPreference = \"Stop\"; Expand-Archive \"{zipName}\" -DestinationPath . -Force; Remove-Item \"{zipName}\" -Force; \".\\{exeName}\"; ";
string command = $"$ErrorActionPreference = \"Stop\"; Wait-Process -Name \"GHelper\"; Expand-Archive \"{zipName}\" -DestinationPath . -Force; Remove-Item \"{zipName}\" -Force; \".\\{exeName}\"; ";
Logger.WriteLine(command);
try
@@ -139,7 +139,7 @@ namespace GHelper.AutoUpdate
Logger.WriteLine(ex.Message);
}
Application.Exit();
Environment.Exit(0);
}
}