aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
diff options
context:
space:
mode:
authorSven Van den brande <sven.vandenbrande@outlook.com>2013-10-31 21:46:03 +0100
committerSven Van den brande <sven.vandenbrande@outlook.com>2013-10-31 21:46:03 +0100
commite8f8d6651c86b3fd3350a5afae1d759fbbad06bd (patch)
tree6496b1525f0dfc448f0250f4fddaa634296ae94b /MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
parent28ab28768a307d1cac60ebe79163b98291068cde (diff)
parent882d0681e68c5e0ae663cca75752e4df765c8dd5 (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs')
-rw-r--r--MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
index b75234107..0d6ba5c1d 100644
--- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
@@ -34,6 +34,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
public delegate HttpClient GetHttpClientHandler(bool enableHttpCompression);
private readonly GetHttpClientHandler _getHttpClientHandler;
+ private readonly IFileSystem _fileSystem;
/// <summary>
/// Initializes a new instance of the <see cref="HttpClientManager"/> class.
@@ -46,7 +47,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
/// or
/// logger
/// </exception>
- public HttpClientManager(IApplicationPaths appPaths, ILogger logger, GetHttpClientHandler getHttpClientHandler)
+ public HttpClientManager(IApplicationPaths appPaths, ILogger logger, GetHttpClientHandler getHttpClientHandler, IFileSystem fileSystem)
{
if (appPaths == null)
{
@@ -59,6 +60,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
_logger = logger;
_getHttpClientHandler = getHttpClientHandler;
+ _fileSystem = fileSystem;
_appPaths = appPaths;
}
@@ -417,7 +419,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
// We're not able to track progress
using (var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
{
- using (var fs = new FileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous))
+ using (var fs = _fileSystem.GetFileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.Read, true))
{
await stream.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, options.CancellationToken).ConfigureAwait(false);
}
@@ -427,7 +429,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
{
using (var stream = ProgressStream.CreateReadProgressStream(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), options.Progress.Report, contentLength.Value))
{
- using (var fs = new FileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous))
+ using (var fs = _fileSystem.GetFileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.Read, true))
{
await stream.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, options.CancellationToken).ConfigureAwait(false);
}