@@ -47,19 +47,14 @@ public static HttpProxy Proxy
47
47
}
48
48
}
49
49
50
- private static readonly WebProxy _proxy = new WebProxy ( ) ;
51
-
52
- public static WebProxy WebProxy
53
- {
54
- get { return _proxy ; }
55
- }
50
+ public static WebProxy WebProxy { get ; } = new WebProxy ( ) ;
56
51
57
52
/// <summary>
58
53
/// Update the Address of the Proxy to modify the client Proxy
59
54
/// </summary>
60
55
public static void UpdateProxy ( ProxyProperty property )
61
56
{
62
- ( _proxy . Address , _proxy . Credentials ) = property switch
57
+ ( WebProxy . Address , WebProxy . Credentials ) = property switch
63
58
{
64
59
ProxyProperty . Enabled => Proxy . Enabled switch
65
60
{
@@ -72,10 +67,10 @@ public static void UpdateProxy(ProxyProperty property)
72
67
} ,
73
68
false => ( null , null )
74
69
} ,
75
- ProxyProperty . Server => ( new Uri ( $ "http://{ Proxy . Server } :{ Proxy . Port } ") , _proxy . Credentials ) ,
76
- ProxyProperty . Port => ( new Uri ( $ "http://{ Proxy . Server } :{ Proxy . Port } ") , _proxy . Credentials ) ,
77
- ProxyProperty . UserName => ( _proxy . Address , new NetworkCredential ( Proxy . UserName , Proxy . Password ) ) ,
78
- ProxyProperty . Password => ( _proxy . Address , new NetworkCredential ( Proxy . UserName , Proxy . Password ) ) ,
70
+ ProxyProperty . Server => ( new Uri ( $ "http://{ Proxy . Server } :{ Proxy . Port } ") , WebProxy . Credentials ) ,
71
+ ProxyProperty . Port => ( new Uri ( $ "http://{ Proxy . Server } :{ Proxy . Port } ") , WebProxy . Credentials ) ,
72
+ ProxyProperty . UserName => ( WebProxy . Address , new NetworkCredential ( Proxy . UserName , Proxy . Password ) ) ,
73
+ ProxyProperty . Password => ( WebProxy . Address , new NetworkCredential ( Proxy . UserName , Proxy . Password ) ) ,
79
74
_ => throw new ArgumentOutOfRangeException ( )
80
75
} ;
81
76
}
0 commit comments