Student Main 6 years ago
parent
commit
9368f444d5
2 changed files with 8 additions and 7 deletions
  1. +1
    -0
      shadowsocks-csharp/Model/SysproxyConfig.cs
  2. +7
    -7
      shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs

+ 1
- 0
shadowsocks-csharp/Model/SysproxyConfig.cs View File

@@ -19,6 +19,7 @@ namespace Shadowsocks.Model
{
UserSettingsRecorded = false;
Flags = "1";
// Watchout, Nullable! See #2100
ProxyServer = "";
BypassList = "";
PacUrl = "";


+ 7
- 7
shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs View File

@@ -16,7 +16,7 @@ namespace Shadowsocks.Util.SystemProxy
{
private const string _userWininetConfigFile = "user-wininet.json";
private static string[] _lanIP = {
private readonly static string[] _lanIP = {
"<local>",
"localhost",
"127.*",
@@ -88,10 +88,11 @@ namespace Shadowsocks.Util.SystemProxy
string arguments;
if (enable)
{
List<string> customBypass = new List<string>(_userSettings.BypassList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
customBypass.AddRange(_lanIP);
string[] realBypassStrings = customBypass.Distinct().ToArray();
string realBypassString = string.Join(";", realBypassStrings);
string customBypassString = _userSettings.BypassList ?? "";
List<string> customBypassList = new List<string>(customBypassString.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
customBypassList.AddRange(_lanIP);
string[] realBypassList = customBypassList.Distinct().ToArray();
string realBypassString = string.Join(";", realBypassList);
arguments = global
? $"global {proxyServer} {realBypassString}"
@@ -114,7 +115,6 @@ namespace Shadowsocks.Util.SystemProxy
ExecSysproxy(arguments);
}
// set system proxy to 1 (null) (null) (null)
public static bool ResetIEProxy()
{
@@ -126,7 +126,7 @@ namespace Shadowsocks.Util.SystemProxy
// clear system setting
ExecSysproxy("set 1 - - -");
}
catch (Exception e)
catch (Exception)
{
return false;
}


Loading…
Cancel
Save