Skip to content

Commit 664eaf6

Browse files
committed
Auto Update tweaks #3568
1 parent 3feae30 commit 664eaf6

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

app/AutoUpdate/AutoUpdateControl.cs

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

86+
if (Program.actionParam == "autoupdate")
87+
{
88+
AutoUpdate(url);
89+
return;
90+
}
91+
8692
if (AppConfig.GetString("skip_version") != tag)
8793
{
8894
DialogResult dialogResult = MessageBox.Show(Properties.Strings.DownloadUpdate + ": G-Helper " + tag + "?", "Update", MessageBoxButtons.YesNo);
@@ -109,7 +115,7 @@ async void CheckForUpdatesAsync()
109115

110116
public static string EscapeString(string input)
111117
{
112-
return Regex.Replace(input, @"\[|\]", "`$0");
118+
return Regex.Replace(input, @"\[|\]", "`$0").Replace("'","''");
113119
}
114120

115121
async void AutoUpdate(string requestUri)
@@ -120,6 +126,7 @@ async void AutoUpdate(string requestUri)
120126

121127
string exeLocation = Application.ExecutablePath;
122128
string exeDir = Path.GetDirectoryName(exeLocation);
129+
exeDir = "C:\\Program Files\\GHelper";
123130
string exeName = Path.GetFileName(exeLocation);
124131
string zipLocation = exeDir + "\\" + zipName;
125132

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 = "";
4950

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

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

57-
if (action == "charge")
57+
if (actionParam == "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('\\') || action.Length > 0)
134+
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || actionParam.Length > 0)
135135
{
136136
SettingsToggle(false);
137137
}
138138

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

0 commit comments

Comments
 (0)