This commit is contained in:
BubbaGumpShrump 2024-12-08 15:31:31 -05:00
parent af8d0a756b
commit 256407c654
2 changed files with 21 additions and 6 deletions
AutoTrackR2
AutoTrackR2_Setup

View file

@ -160,10 +160,16 @@ namespace AutoTrackR2
private async Task<string> DownloadInstallerToDownloads(string url) private async Task<string> DownloadInstallerToDownloads(string url)
{ {
// Get the path to the user's Downloads folder // Get the path to the user's Downloads folder (this works for OneDrive and other cloud storage setups)
string downloadsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Downloads"; string downloadsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
string installerPath = Path.Combine(downloadsFolder, "AutoTrackR2_Setup.msi"); 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(); using var client = new HttpClient();
var response = await client.GetAsync(url); var response = await client.GetAsync(url);
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
@ -179,8 +185,17 @@ namespace AutoTrackR2
{ {
try try
{ {
// Start the installer manually (this will let the user run it) // Prepare the command to run the .msi installer using msiexec
System.Diagnostics.Process.Start(installerPath); 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) catch (Exception ex)
{ {

View file

@ -198,8 +198,8 @@
{ {
"Name" = "8:Microsoft Visual Studio" "Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:AutoTrackR2_Setup" "ProductName" = "8:AutoTrackR2_Setup"
"ProductCode" = "8:{F79114DA-3386-4C48-8836-A39014EFC706}" "ProductCode" = "8:{B4E6C891-C68D-466A-A97A-D4B3790DEEC3}"
"PackageCode" = "8:{AE03249A-7FA7-432F-A8D6-D6B34490F51F}" "PackageCode" = "8:{BB4766E4-3735-42A8-8486-1EABBE42C442}"
"UpgradeCode" = "8:{0B78A147-D0DE-4F72-8906-A62611787CA7}" "UpgradeCode" = "8:{0B78A147-D0DE-4F72-8906-A62611787CA7}"
"AspNetVersion" = "8:" "AspNetVersion" = "8:"
"RestartWWWService" = "11:FALSE" "RestartWWWService" = "11:FALSE"