diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-02-04 12:21:42 +0100 |
|---|---|---|
| committer | Bond-009 <bond.009@outlook.com> | 2020-02-04 12:21:42 +0100 |
| commit | ba1ffbabd3c1fc610b3f0a3de47dbc670920f915 (patch) | |
| tree | 069c76ee43d1bb5ca4ee1f72f0c95edfe484ed7e /Emby.Server.Implementations/HttpServer/FileWriter.cs | |
| parent | 5dc3874ebdeac26d7be885b9a44ca1321b4b25cf (diff) | |
| parent | 176e8509739ffd3d7002c94adbd814c33b5172e2 (diff) | |
Merge branch 'master' into nullable2
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/FileWriter.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/FileWriter.cs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/HttpServer/FileWriter.cs b/Emby.Server.Implementations/HttpServer/FileWriter.cs index c1c8c3eb3..d36f230d6 100644 --- a/Emby.Server.Implementations/HttpServer/FileWriter.cs +++ b/Emby.Server.Implementations/HttpServer/FileWriter.cs @@ -1,4 +1,5 @@ #pragma warning disable CS1591 +#pragma warning disable SA1600 using System; using System.Collections.Generic; @@ -71,7 +72,7 @@ namespace Emby.Server.Implementations.HttpServer SetRangeValues(); } - FileShare = FileShareMode.Read; + FileShare = FileShare.Read; Cookies = new List<Cookie>(); } @@ -93,7 +94,7 @@ namespace Emby.Server.Implementations.HttpServer public List<Cookie> Cookies { get; private set; } - public FileShareMode FileShare { get; set; } + public FileShare FileShare { get; set; } /// <summary> /// Gets the options. @@ -221,17 +222,17 @@ namespace Emby.Server.Implementations.HttpServer } } - public async Task TransmitFile(Stream stream, string path, long offset, long count, FileShareMode fileShareMode, CancellationToken cancellationToken) + public async Task TransmitFile(Stream stream, string path, long offset, long count, FileShare fileShare, CancellationToken cancellationToken) { - var fileOpenOptions = FileOpenOptions.SequentialScan; + var fileOptions = FileOptions.SequentialScan; // use non-async filestream along with read due to https://github.com/dotnet/corefx/issues/6039 if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - fileOpenOptions |= FileOpenOptions.Asynchronous; + fileOptions |= FileOptions.Asynchronous; } - using (var fs = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, fileShareMode, fileOpenOptions)) + using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, fileShare, IODefaults.FileStreamBufferSize, fileOptions)) { if (offset > 0) { @@ -244,7 +245,7 @@ namespace Emby.Server.Implementations.HttpServer } else { - await fs.CopyToAsync(stream, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false); + await fs.CopyToAsync(stream, IODefaults.CopyToBufferSize, cancellationToken).ConfigureAwait(false); } } } |
