Skip to content

Commit 0d9ec48

Browse files
committed
Code quality
1 parent 9b5d22a commit 0d9ec48

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Flow.Launcher.Core/ExternalPlugins/CommunityPluginSource.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public record CommunityPluginSource(string ManifestFileUrl)
1919

2020
private List<UserPlugin> plugins = new();
2121

22-
private static JsonSerializerOptions PluginStoreItemSerializationOption = new JsonSerializerOptions()
22+
private static readonly JsonSerializerOptions PluginStoreItemSerializationOption = new()
2323
{
2424
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault
2525
};
@@ -45,18 +45,18 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
4545

4646
if (response.StatusCode == HttpStatusCode.OK)
4747
{
48-
this.plugins = await response.Content
48+
plugins = await response.Content
4949
.ReadFromJsonAsync<List<UserPlugin>>(PluginStoreItemSerializationOption, cancellationToken: token)
5050
.ConfigureAwait(false);
51-
this.latestEtag = response.Headers.ETag?.Tag;
51+
latestEtag = response.Headers.ETag?.Tag;
5252

53-
Log.Info(nameof(CommunityPluginSource), $"Loaded {this.plugins.Count} plugins from {ManifestFileUrl}");
54-
return this.plugins;
53+
Log.Info(nameof(CommunityPluginSource), $"Loaded {plugins.Count} plugins from {ManifestFileUrl}");
54+
return plugins;
5555
}
5656
else if (response.StatusCode == HttpStatusCode.NotModified)
5757
{
5858
Log.Info(nameof(CommunityPluginSource), $"Resource {ManifestFileUrl} has not been modified.");
59-
return this.plugins;
59+
return plugins;
6060
}
6161
else
6262
{

Flow.Launcher.Infrastructure/Http/Http.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ public static class Http
1616
{
1717
private const string UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko";
1818

19-
private static HttpClient client = new HttpClient();
19+
private static readonly HttpClient client = new();
2020

2121
static Http()
2222
{
2323
// need to be added so it would work on a win10 machine
2424
ServicePointManager.Expect100Continue = true;
2525
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls
26-
| SecurityProtocolType.Tls11
27-
| SecurityProtocolType.Tls12;
26+
| SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
2827

2928
client.DefaultRequestHeaders.Add("User-Agent", UserAgent);
3029
HttpClient.DefaultProxy = WebProxy;
@@ -72,7 +71,7 @@ var userName when string.IsNullOrEmpty(userName) =>
7271
ProxyProperty.Port => (new Uri($"http://{Proxy.Server}:{Proxy.Port}"), WebProxy.Credentials),
7372
ProxyProperty.UserName => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
7473
ProxyProperty.Password => (WebProxy.Address, new NetworkCredential(Proxy.UserName, Proxy.Password)),
75-
_ => throw new ArgumentOutOfRangeException()
74+
_ => throw new ArgumentOutOfRangeException(null)
7675
};
7776
}
7877
catch (UriFormatException e)

0 commit comments

Comments
 (0)