Skip to content

Commit

Permalink
try fix shadowsocks#105
Browse files Browse the repository at this point in the history
  • Loading branch information
clowwindy committed Jan 11, 2015
1 parent 797bd86 commit 70d7e81
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions shadowsocks-csharp/Controller/SystemProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;

namespace Shadowsocks.Controller
{
Expand Down Expand Up @@ -79,18 +80,24 @@ private static void CopyProxySettingFromLan()
RegistryKey registry =
Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Connections",
true);
var defulatValue = registry.GetValue("DefaultConnectionSettings");
var connections = registry.GetValueNames();
foreach (String each in connections){
if (!(each.Equals("DefaultConnectionSettings")
|| each.Equals("LAN Connection")
|| each.Equals("SavedLegacySettings")))
var defaultValue = registry.GetValue("DefaultConnectionSettings");
try
{
var connections = registry.GetValueNames();
foreach (String each in connections)
{
//set all the connections's proxy as the lan
registry.SetValue(each, defulatValue);
if (!(each.Equals("DefaultConnectionSettings")
|| each.Equals("LAN Connection")
|| each.Equals("SavedLegacySettings")))
{
//set all the connections's proxy as the lan
registry.SetValue(each, defaultValue);
}
}
SystemProxy.NotifyIE();
} catch (IOException e) {
Logging.LogUsefulException(e);
}
NotifyIE();
}

private static String GetTimestamp(DateTime value)
Expand Down

0 comments on commit 70d7e81

Please sign in to comment.