mirror of
https://github.com/BubbaGumpShrump/AutoTrackR2.git
synced 2025-07-13 14:57:49 +00:00
Fix
This commit is contained in:
parent
af8d0a756b
commit
256407c654
2 changed files with 21 additions and 6 deletions
AutoTrackR2
|
@ -160,10 +160,16 @@ namespace AutoTrackR2
|
|||
|
||||
private async Task<string> DownloadInstallerToDownloads(string url)
|
||||
{
|
||||
// Get the path to the user's Downloads folder
|
||||
string downloadsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Downloads";
|
||||
// Get the path to the user's Downloads folder (this works for OneDrive and other cloud storage setups)
|
||||
string downloadsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
|
||||
string installerPath = Path.Combine(downloadsFolder, "AutoTrackR2_Setup.msi");
|
||||
|
||||
// Ensure the downloads folder exists
|
||||
if (!Directory.Exists(downloadsFolder))
|
||||
{
|
||||
throw new Exception($"Downloads folder not found at: {downloadsFolder}");
|
||||
}
|
||||
|
||||
using var client = new HttpClient();
|
||||
var response = await client.GetAsync(url);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
@ -179,8 +185,17 @@ namespace AutoTrackR2
|
|||
{
|
||||
try
|
||||
{
|
||||
// Start the installer manually (this will let the user run it)
|
||||
System.Diagnostics.Process.Start(installerPath);
|
||||
// Prepare the command to run the .msi installer using msiexec
|
||||
var processStartInfo = new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = "msiexec",
|
||||
Arguments = $"/i \"{installerPath}\" /norestart", // Silent install with no restart
|
||||
UseShellExecute = true, // Ensures that the process runs in the background
|
||||
CreateNoWindow = true // Hides the command prompt window
|
||||
};
|
||||
|
||||
// Start the process (this will run the installer)
|
||||
System.Diagnostics.Process.Start(processStartInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue