From 07dc69fbc9416f77ac94a0ab5bee734ef4266ace Mon Sep 17 00:00:00 2001 From: clowwindy Date: Thu, 1 Jan 2015 21:57:28 +0800 Subject: [PATCH] format --- shadowsocks-csharp/Controller/AutoStartup.cs | 86 +++++++++++--------- 1 file changed, 49 insertions(+), 37 deletions(-) diff --git a/shadowsocks-csharp/Controller/AutoStartup.cs b/shadowsocks-csharp/Controller/AutoStartup.cs index b040445f..36ad775f 100644 --- a/shadowsocks-csharp/Controller/AutoStartup.cs +++ b/shadowsocks-csharp/Controller/AutoStartup.cs @@ -1,43 +1,55 @@ using System; using System.Windows.Forms; -using Microsoft.Win32; - -namespace Shadowsocks.Controller { - class AutoStartup { - public static bool Set(bool enabled) { - try { - string path = Application.ExecutablePath; - RegistryKey runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); - if (enabled) { - runKey.SetValue("Shadowsocks", path); - } else { - runKey.DeleteValue("Shadowsocks"); - } - runKey.Close(); - return true; - } catch (Exception e) { - Logging.LogUsefulException(e); - return false; - } - } - - public static bool Check() { - try { - string path = Application.ExecutablePath; - RegistryKey runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); - string[] runList = runKey.GetValueNames(); - runKey.Close(); - foreach (string item in runList) { - if (item.Equals("Shadowsocks")) - return true; - } - return false; +using Microsoft.Win32; + +namespace Shadowsocks.Controller +{ + class AutoStartup + { + public static bool Set(bool enabled) + { + try + { + string path = Application.ExecutablePath; + RegistryKey runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); + if (enabled) + { + runKey.SetValue("Shadowsocks", path); + } + else + { + runKey.DeleteValue("Shadowsocks"); + } + runKey.Close(); + return true; } catch (Exception e) { - Logging.LogUsefulException(e); - return false; - } - } - } + Logging.LogUsefulException(e); + return false; + } + } + + public static bool Check() + { + try + { + string path = Application.ExecutablePath; + RegistryKey runKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); + string[] runList = runKey.GetValueNames(); + runKey.Close(); + foreach (string item in runList) + { + if (item.Equals("Shadowsocks")) + return true; + } + return false; + } + catch (Exception e) + { + Logging.LogUsefulException(e); + return false; + } + } + } }