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 3feae30 commit 664eaf6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion app/AutoUpdate/AutoUpdateControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ async void CheckForUpdatesAsync()
versionUrl = url;
settings.SetVersionLabel(Properties.Strings.DownloadUpdate + ": " + tag, true);

if (Program.actionParam == "autoupdate")
{
AutoUpdate(url);
return;
}

if (AppConfig.GetString("skip_version") != tag)
{
DialogResult dialogResult = MessageBox.Show(Properties.Strings.DownloadUpdate + ": G-Helper " + tag + "?", "Update", MessageBoxButtons.YesNo);
Expand All @@ -109,7 +115,7 @@ async void CheckForUpdatesAsync()

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

async void AutoUpdate(string requestUri)
Expand All @@ -120,6 +126,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)
{

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

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

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

0 comments on commit 664eaf6

Please sign in to comment.