From 98050cc162a82df9900cc1d26952f18829f39da4 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Tue, 4 Nov 2014 22:29:56 +0800 Subject: [PATCH] use PAC instead --- shadowsocks-csharp/SystemProxy.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/shadowsocks-csharp/SystemProxy.cs b/shadowsocks-csharp/SystemProxy.cs index fe10bd5f..a024d8db 100755 --- a/shadowsocks-csharp/SystemProxy.cs +++ b/shadowsocks-csharp/SystemProxy.cs @@ -15,7 +15,7 @@ namespace shadowsocks_csharp public const int INTERNET_OPTION_REFRESH = 37; static bool settingsReturn, refreshReturn; - public static void UpdateIE() + public static void NotifyIE() { // These lines implement the Interface in the beginning of program // They cause the OS to refresh the settings, causing IP to realy update @@ -26,9 +26,10 @@ namespace shadowsocks_csharp public static void Enable() { RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true); - registry.SetValue("ProxyEnable", 1); - registry.SetValue("ProxyServer", "127.0.0.1:8123"); - SystemProxy.UpdateIE(); + registry.SetValue("ProxyEnable", 0); + registry.SetValue("ProxyServer", ""); + registry.SetValue("AutoConfigURL", "http://127.0.0.1:8090/pac"); + SystemProxy.NotifyIE(); } public static void Disable() @@ -36,7 +37,8 @@ namespace shadowsocks_csharp RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true); registry.SetValue("ProxyEnable", 0); registry.SetValue("ProxyServer", ""); - SystemProxy.UpdateIE(); + registry.SetValue("AutoConfigURL", ""); + SystemProxy.NotifyIE(); } } }