Skip to content

Commit 2b929bc

Browse files
committed
Auto update tweaks #3568
1 parent 9a88cc6 commit 2b929bc

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

app/AutoUpdate/AutoUpdateControl.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ async void CheckForUpdatesAsync()
8383
versionUrl = url;
8484
settings.SetVersionLabel(Properties.Strings.DownloadUpdate + ": " + tag, true);
8585

86-
if (Program.actionParam == "autoupdate")
86+
string[] args = Environment.GetCommandLineArgs();
87+
if (args.Length > 1 && args[1] == "autoupdate")
8788
{
8889
AutoUpdate(url);
8990
return;
@@ -115,7 +116,7 @@ async void CheckForUpdatesAsync()
115116

116117
public static string EscapeString(string input)
117118
{
118-
return Regex.Replace(input, @"\[|\]", "`$0").Replace("'","''");
119+
return Regex.Replace(Regex.Replace(input, @"\[|\]", "`$0"), @"\'", "''");
119120
}
120121

121122
async void AutoUpdate(string requestUri)
@@ -126,6 +127,7 @@ async void AutoUpdate(string requestUri)
126127

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

app/Program.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ static class Program
4646
public static InputDispatcher? inputDispatcher;
4747

4848
private static PowerLineStatus isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
49-
public static string actionParam = "";
5049

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

55-
if (args.Length > 0) actionParam = args[0];
54+
string action = "";
55+
if (args.Length > 0) action = args[0];
5656

57-
if (actionParam == "charge")
57+
if (action == "charge")
5858
{
5959
BatteryLimit();
6060
Application.Exit();
@@ -131,12 +131,12 @@ public static void Main(string[] args)
131131
Task task = Task.Run((Action)PeripheralsProvider.DetectAllAsusMice);
132132
PeripheralsProvider.RegisterForDeviceEvents();
133133

134-
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || actionParam.Length > 0)
134+
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0)
135135
{
136136
SettingsToggle(false);
137137
}
138138

139-
switch (actionParam)
139+
switch (action)
140140
{
141141
case "cpu":
142142
Startup.ReScheduleAdmin();

0 commit comments

Comments
 (0)