调整写法

This commit is contained in:
Genteure 2020-08-14 17:01:04 +08:00
parent 164136071b
commit 89952058a8

View File

@ -18,6 +18,7 @@ namespace BililiveRecorder.Core
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private static readonly Random random = new Random();
private static readonly Version VERSION_1_0 = new Version(1, 0);
private int _roomid;
private int _realRoomid;
@ -310,9 +311,13 @@ namespace BililiveRecorder.Core
};
_stream = await _response.Content.ReadAsStreamAsync();
if (!new object[] { null, true }.Contains(_response.Headers.ConnectionClose))
_stream.ReadTimeout = 3 * 1000;
try
{
if (_response.Headers.ConnectionClose == false || (_response.Headers.ConnectionClose is null && _response.Version != VERSION_1_0))
_stream.ReadTimeout = 3 * 1000;
}
catch (InvalidOperationException) { }
StreamDownloadTask = Task.Run(_ReadStreamLoop);
TriggerPropertyChanged(nameof(IsRecording));