Skip to content

Commit e364b84

Browse files
committed
Use auto property
1 parent 4d5119f commit e364b84

File tree

1 file changed

+6
-11
lines changed
  • Flow.Launcher.Infrastructure/Http

1 file changed

+6
-11
lines changed

Flow.Launcher.Infrastructure/Http/Http.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,14 @@ public static HttpProxy Proxy
4747
}
4848
}
4949

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();
5651

5752
/// <summary>
5853
/// Update the Address of the Proxy to modify the client Proxy
5954
/// </summary>
6055
public static void UpdateProxy(ProxyProperty property)
6156
{
62-
(_proxy.Address, _proxy.Credentials) = property switch
57+
(WebProxy.Address, WebProxy.Credentials) = property switch
6358
{
6459
ProxyProperty.Enabled => Proxy.Enabled switch
6560
{
@@ -72,10 +67,10 @@ public static void UpdateProxy(ProxyProperty property)
7267
},
7368
false => (null, null)
7469
},
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)),
7974
_ => throw new ArgumentOutOfRangeException()
8075
};
8176
}

0 commit comments

Comments
 (0)