Skip to content

Commit

Permalink
Auto update tweaks #3568
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Jan 8, 2025
1 parent 9a88cc6 commit 2b929bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions app/AutoUpdate/AutoUpdateControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ async void CheckForUpdatesAsync()
versionUrl = url;
settings.SetVersionLabel(Properties.Strings.DownloadUpdate + ": " + tag, true);

if (Program.actionParam == "autoupdate")
string[] args = Environment.GetCommandLineArgs();
if (args.Length > 1 && args[1] == "autoupdate")
{
AutoUpdate(url);
return;
Expand Down Expand Up @@ -115,7 +116,7 @@ async void CheckForUpdatesAsync()

public static string EscapeString(string input)
{
return Regex.Replace(input, @"\[|\]", "`$0").Replace("'","''");
return Regex.Replace(Regex.Replace(input, @"\[|\]", "`$0"), @"\'", "''");
}

async void AutoUpdate(string requestUri)
Expand All @@ -126,6 +127,7 @@ async void AutoUpdate(string requestUri)

string exeLocation = Application.ExecutablePath;
string exeDir = Path.GetDirectoryName(exeLocation);
//exeDir = "C:\\Program Files\\GHelper";
string exeName = Path.GetFileName(exeLocation);
string zipLocation = exeDir + "\\" + zipName;

Expand Down
10 changes: 5 additions & 5 deletions app/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ static class Program
public static InputDispatcher? inputDispatcher;

private static PowerLineStatus isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
public static string actionParam = "";

// The main entry point for the application
public static void Main(string[] args)
{

if (args.Length > 0) actionParam = args[0];
string action = "";
if (args.Length > 0) action = args[0];

if (actionParam == "charge")
if (action == "charge")
{
BatteryLimit();
Application.Exit();
Expand Down Expand Up @@ -131,12 +131,12 @@ public static void Main(string[] args)
Task task = Task.Run((Action)PeripheralsProvider.DetectAllAsusMice);
PeripheralsProvider.RegisterForDeviceEvents();

if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || actionParam.Length > 0)
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0)
{
SettingsToggle(false);
}

switch (actionParam)
switch (action)
{
case "cpu":
Startup.ReScheduleAdmin();
Expand Down

0 comments on commit 2b929bc

Please sign in to comment.