aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-31 10:03:23 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-31 10:03:23 -0400
commit6c8d9192985036acb3d1fe626ed57980bb862d6a (patch)
tree94d59b266b877bf0b073c5e3291cb2822dc055f7 /MediaBrowser.Server.Implementations/HttpServer
parent579b507f7fa322fdf8a746b6e787015d0567e2a6 (diff)
replace file system calls with IFileSystem when needed
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
index 356c6fc4d..e6942fae6 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Logging;
using ServiceStack.Common;
using ServiceStack.Common.Web;
@@ -25,13 +26,15 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// The _logger
/// </summary>
private readonly ILogger _logger;
+ private readonly IFileSystem _fileSystem;
/// <summary>
/// Initializes a new instance of the <see cref="HttpResultFactory"/> class.
/// </summary>
/// <param name="logManager">The log manager.</param>
- public HttpResultFactory(ILogManager logManager)
+ public HttpResultFactory(ILogManager logManager, IFileSystem fileSystem)
{
+ _fileSystem = fileSystem;
_logger = logManager.GetLogger("HttpResultFactory");
}
@@ -288,7 +291,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
throw new ArgumentException("FileShare must be either Read or ReadWrite");
}
- var dateModified = File.GetLastWriteTimeUtc(path);
+ var dateModified = _fileSystem.GetLastWriteTimeUtc(path);
var cacheKey = path + dateModified.Ticks;
@@ -303,7 +306,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <returns>Stream.</returns>
private Stream GetFileStream(string path, FileShare fileShare)
{
- return new FileStream(path, FileMode.Open, FileAccess.Read, fileShare, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous);
+ return _fileSystem.GetFileStream(path, FileMode.Open, FileAccess.Read, fileShare, true);
}
/// <summary>