AutoUpdate improvements

This commit is contained in:
Serge
2023-12-24 15:50:30 +01:00
parent 2bc4151c7a
commit 4f3ae43c3b
2 changed files with 22 additions and 9 deletions

View File

@@ -355,7 +355,7 @@ public static class AppConfig
public static bool IsStrixLimitedRGB() public static bool IsStrixLimitedRGB()
{ {
return ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G513QM") || ContainsModel("G713RC"); return ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC");
} }
public static bool IsStrixNumpad() public static bool IsStrixNumpad()

View File

@@ -107,6 +107,7 @@ namespace GHelper.AutoUpdate
string exeLocation = Application.ExecutablePath; string exeLocation = Application.ExecutablePath;
string exeDir = Path.GetDirectoryName(exeLocation); string exeDir = Path.GetDirectoryName(exeLocation);
string exeName = Path.GetFileName(exeLocation);
string zipLocation = exeDir + "\\" + zipName; string zipLocation = exeDir + "\\" + zipName;
using (WebClient client = new WebClient()) using (WebClient client = new WebClient())
@@ -114,15 +115,27 @@ namespace GHelper.AutoUpdate
client.DownloadFile(uri, zipLocation); client.DownloadFile(uri, zipLocation);
Logger.WriteLine(requestUri); Logger.WriteLine(requestUri);
Logger.WriteLine(zipLocation); Logger.WriteLine(exeDir);
Logger.WriteLine(exeLocation); Logger.WriteLine(zipName);
Logger.WriteLine(exeName);
var cmd = new Process(); string command = $"Start-Sleep -Seconds 1; Expand-Archive \"{zipName}\" -DestinationPath . -Force; Remove-Item \"{zipName}\" -Force; \".\\{exeName}\"; ";
cmd.StartInfo.UseShellExecute = false; Logger.WriteLine(command);
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.FileName = "powershell"; try
cmd.StartInfo.Arguments = $"Start-Sleep -Seconds 1; Expand-Archive {zipLocation} -DestinationPath {exeDir} -Force; Remove-Item {zipLocation} -Force; {exeLocation}"; {
cmd.Start(); var cmd = new Process();
cmd.StartInfo.WorkingDirectory = exeDir;
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.FileName = "powershell";
cmd.StartInfo.Arguments = command;
cmd.Start();
}
catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}
Application.Exit(); Application.Exit();
} }