diff --git a/shadowsocks-csharp/Controller/System/AutoStartup.cs b/shadowsocks-csharp/Controller/System/AutoStartup.cs index a2ad21c1..06180bdb 100644 --- a/shadowsocks-csharp/Controller/System/AutoStartup.cs +++ b/shadowsocks-csharp/Controller/System/AutoStartup.cs @@ -1,5 +1,5 @@ -using System; -using System.Windows.Forms; +using System; +using System.Windows.Forms; using Microsoft.Win32; namespace Shadowsocks.Controller @@ -14,7 +14,7 @@ namespace Shadowsocks.Controller try { string path = Application.ExecutablePath; - runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); + runKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); if (enabled) { runKey.SetValue(Key, path); @@ -47,13 +47,13 @@ namespace Shadowsocks.Controller try { string path = Application.ExecutablePath; - runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); + runKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); string[] runList = runKey.GetValueNames(); foreach (string item in runList) { - if (item.Equals(Key)) + if (item == Key) return true; - else if (item.Equals("Shadowsocks")) // Compatibility with older versions + else if (item == "Shadowsocks") // Compatibility with older versions { string value = Convert.ToString(runKey.GetValue(item)); if (path.Equals(value, StringComparison.InvariantCultureIgnoreCase)) @@ -82,4 +82,4 @@ namespace Shadowsocks.Controller } } } -} +}