Code revie
This commit is contained in:
parent
f73bb92ce3
commit
21fd124bca
|
@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
_logFileStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
_logFileStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
||||||
|
|
||||||
await JsonSerializer.SerializeAsync(_logFileStream, mediaSource, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
await JsonSerializer.SerializeAsync(_logFileStream, mediaSource, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||||
await _logFileStream.WriteAsync(Encoding.UTF8.GetBytes(Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine), cancellationToken);
|
await _logFileStream.WriteAsync(Encoding.UTF8.GetBytes(Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine), cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
_process = new Process
|
_process = new Process
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Scheduled Task history file {path} is empty. Skipping deserialization.", path);
|
_logger.LogDebug("Scheduled Task history file {Path} is empty. Skipping deserialization.", path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -577,8 +577,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
|
|
||||||
using FileStream stream = File.OpenWrite(path);
|
var json = JsonSerializer.Serialize(triggers, _jsonOptions);
|
||||||
JsonSerializer.SerializeAsync(stream, triggers, _jsonOptions);
|
File.WriteAllText(path, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -351,9 +351,9 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
public async Task<T> GetDeserializedOmdbResponse<T>(HttpClient httpClient, string url, CancellationToken cancellationToken)
|
public async Task<T> GetDeserializedOmdbResponse<T>(HttpClient httpClient, string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
using var response = await GetOmdbResponse(httpClient, url, cancellationToken).ConfigureAwait(false);
|
using var response = await GetOmdbResponse(httpClient, url, cancellationToken).ConfigureAwait(false);
|
||||||
var content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
await using Stream content = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return JsonSerializer.Deserialize<T>(content, _jsonOptions);
|
return await JsonSerializer.DeserializeAsync<T>(content, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task<HttpResponseMessage> GetOmdbResponse(HttpClient httpClient, string url, CancellationToken cancellationToken)
|
public static Task<HttpResponseMessage> GetOmdbResponse(HttpClient httpClient, string url, CancellationToken cancellationToken)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user