File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Plain Craft Launcher 2/Modules/Base Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 11Public Module ModNet
22 Public Const NetDownloadEnd As String = ".PCLDownloading"
33
4- Private Property _Proxy As IWebProxy = WebRequest.GetSystemWebProxy()
54 ''' <summary>
65 ''' 确定是否使用代理。
76 ''' </summary>
87 ''' <returns>返回 WebProxy 或者 Nothing</returns>
98 Public Function GetProxy()
109 Dim proxy As String = Setup.Get( "SystemHttpProxy" )
11- Dim SystemProxy As New WebProxy(_Proxy .GetProxy( New Uri( "https://www.example.com" )))
10+ Dim SystemProxy As New WebProxy(WebRequest.GetSystemWebProxy() .GetProxy( New Uri( "https://www.example.com" )))
1211 If SystemProxy IsNot Nothing AndAlso Setup.Get( "SystemUseDefaultProxy" ) Then
1312 Log( "[Net] 当前代理状态:跟随系统代理设置" )
1413 Return SystemProxy
1514 End If
1615 If Not String .IsNullOrWhiteSpace(proxy) AndAlso Not Setup.Get( "SystemUseDefaultProxy" ) Then
17- _Proxy = New WebProxy(proxy, True )
1816 Log( "[Net] 当前代理状态:自定义" )
19- Dim ProxyUri As New Uri(_Proxy.ToString )
17+ Dim ProxyUri As New Uri(proxy )
2018 Try
2119 If ProxyUri.IsLoopback OrElse
2220 ProxyUri.Host.StartsWithF( "192.168." ) OrElse
2321 ProxyUri.Host.StartsWithF( "10." ) OrElse
2422 ProxyUri.Host.StartsWithF( "fe80" ) OrElse
25- (ProxyUri.Host.Split( "." )( 1 ) > 16 AndAlso ProxyUri.Host.Split( "." )( 1 ) < 31 AndAlso ProxyUri.Host.StartsWithF( "172." )) Then Log( $"[Net] 使用 {_Proxy } 作为网络代理" )
23+ (ProxyUri.Host.Split( "." )( 1 ) > 16 AndAlso ProxyUri.Host.Split( "." )( 1 ) < 31 AndAlso ProxyUri.Host.StartsWithF( "172." )) Then Log( $"[Net] 使用 {ProxyUri } 作为网络代理" )
2624 '视作非本地地址
2725 Catch
2826 End Try
29- Return _Proxy
27+ Return New WebProxy(proxy, True )
3028 End If
3129 Log( "[Net] 当前代理状态:禁用" )
3230 Return Nothing
You can’t perform that action at this time.
0 commit comments