From 24609bf53b6122657afad6f8a231765b3f95f3aa Mon Sep 17 00:00:00 2001 From: Licshee Date: Thu, 4 Feb 2016 12:46:41 +0800 Subject: [PATCH] never use string.Equals(string) if you don't know what you are doing --- .../Controller/System/AutoStartup.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 } } } -} +}