-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'warnings' of https://github.com/nachmore/Flow.Launcher …
…into warnings
- Loading branch information
Showing
12 changed files
with
145 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,4 +93,4 @@ public class JsonRPCResult : Result | |
|
||
public Dictionary<string, object> SettingsChange { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Flow.Launcher.Infrastructure; | ||
using Flow.Launcher.Infrastructure.Logger; | ||
using Microsoft.Win32; | ||
|
||
namespace Flow.Launcher.Helper | ||
{ | ||
public class AutoStartup | ||
{ | ||
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; | ||
|
||
public static bool IsEnabled | ||
{ | ||
get | ||
{ | ||
try | ||
{ | ||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true); | ||
var path = key?.GetValue(Constant.FlowLauncher) as string; | ||
return path == Constant.ExecutablePath; | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.Error("AutoStartup", $"Ignoring non-critical registry error (querying if enabled): {e}"); | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
|
||
public static void Disable() | ||
{ | ||
try | ||
{ | ||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true); | ||
key?.DeleteValue(Constant.FlowLauncher, false); | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.Error("AutoStartup", $"Failed to disable auto-startup: {e}"); | ||
throw; | ||
} | ||
} | ||
|
||
internal static void Enable() | ||
{ | ||
try | ||
{ | ||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true); | ||
key?.SetValue(Constant.FlowLauncher, Constant.ExecutablePath); | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.Error("AutoStartup", $"Failed to enable auto-startup: {e}"); | ||
throw; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters