replace file system calls with IFileSystem when needed

This commit is contained in:
Luke Pulverenti
2013-10-31 10:03:23 -04:00
parent 579b507f7f
commit 6c8d919298
80 changed files with 570 additions and 302 deletions

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
@@ -321,6 +322,18 @@ namespace MediaBrowser.Server.Implementations.IO
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="FileSystemEventArgs" /> instance containing the event data.</param>
void watcher_Changed(object sender, FileSystemEventArgs e)
{
try
{
OnWatcherChanged(e);
}
catch (IOException ex)
{
Logger.ErrorException("IOException in watcher changed", ex);
}
}
private void OnWatcherChanged(FileSystemEventArgs e)
{
var name = e.Name;
@@ -437,7 +450,7 @@ namespace MediaBrowser.Server.Implementations.IO
try
{
using (new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
using (_fileSystem.GetFileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//file is not locked
return false;