mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-01-08 16:53:04 +01:00
Use await using in async methods
This commit is contained in:
parent
d38f2614d3
commit
34fbb3e135
2 changed files with 6 additions and 15 deletions
|
|
@ -322,7 +322,7 @@ public async Task DownloadFileAsync(string url, string fileName)
|
|||
_logger.Debug("Downloading [{0}] to [{1}]", url, fileName);
|
||||
|
||||
var stopWatch = Stopwatch.StartNew();
|
||||
using (var fileStream = new FileStream(fileNamePart, FileMode.Create, FileAccess.ReadWrite))
|
||||
await using (var fileStream = new FileStream(fileNamePart, FileMode.Create, FileAccess.ReadWrite))
|
||||
{
|
||||
var request = new HttpRequest(url);
|
||||
request.AllowAutoRedirect = true;
|
||||
|
|
|
|||
|
|
@ -179,21 +179,12 @@ private async Task CopyInto(IDictionary<string, string> dictionary, string resou
|
|||
return;
|
||||
}
|
||||
|
||||
using (var fs = File.OpenRead(resourcePath))
|
||||
{
|
||||
if (fs != null)
|
||||
{
|
||||
var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(fs);
|
||||
await using var fs = File.OpenRead(resourcePath);
|
||||
var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(fs);
|
||||
|
||||
foreach (var key in dict.Keys)
|
||||
{
|
||||
dictionary[key] = dict[key];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Missing translation/culture resource: {0}", resourcePath);
|
||||
}
|
||||
foreach (var key in dict.Keys)
|
||||
{
|
||||
dictionary[key] = dict[key];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue