@@ -16,7 +16,7 @@ public static class Sysproxy
16
16
{
17
17
private const string _userWininetConfigFile = "user-wininet.json" ;
18
18
19
- private static string [ ] _lanIP = {
19
+ private readonly static string [ ] _lanIP = {
20
20
"<local>" ,
21
21
"localhost" ,
22
22
"127.*" ,
@@ -88,10 +88,11 @@ public static void SetIEProxy(bool enable, bool global, string proxyServer, stri
88
88
string arguments ;
89
89
if ( enable )
90
90
{
91
- List < string > customBypass = new List < string > ( _userSettings . BypassList . Split ( new char [ ] { ';' } , StringSplitOptions . RemoveEmptyEntries ) ) ;
92
- customBypass . AddRange ( _lanIP ) ;
93
- string [ ] realBypassStrings = customBypass . Distinct ( ) . ToArray ( ) ;
94
- string realBypassString = string . Join ( ";" , realBypassStrings ) ;
91
+ string customBypassString = _userSettings . BypassList ?? "" ;
92
+ List < string > customBypassList = new List < string > ( customBypassString . Split ( new char [ ] { ';' } , StringSplitOptions . RemoveEmptyEntries ) ) ;
93
+ customBypassList . AddRange ( _lanIP ) ;
94
+ string [ ] realBypassList = customBypassList . Distinct ( ) . ToArray ( ) ;
95
+ string realBypassString = string . Join ( ";" , realBypassList ) ;
95
96
96
97
arguments = global
97
98
? $ "global { proxyServer } { realBypassString } "
@@ -114,7 +115,6 @@ public static void SetIEProxy(bool enable, bool global, string proxyServer, stri
114
115
ExecSysproxy ( arguments ) ;
115
116
}
116
117
117
-
118
118
// set system proxy to 1 (null) (null) (null)
119
119
public static bool ResetIEProxy ( )
120
120
{
@@ -126,7 +126,7 @@ public static bool ResetIEProxy()
126
126
// clear system setting
127
127
ExecSysproxy ( "set 1 - - -" ) ;
128
128
}
129
- catch ( Exception e )
129
+ catch ( Exception )
130
130
{
131
131
return false ;
132
132
}
0 commit comments