aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Providers/DirectoryService.cs
diff options
context:
space:
mode:
author7illusions <z@7illusions.com>2014-05-12 16:55:07 +0200
committer7illusions <z@7illusions.com>2014-05-12 16:55:07 +0200
commitbaf5cf2544fcaad2246923f60caaf3fed4a94aaf (patch)
treea808b700095f876e437b95c432c0220e241f9fda /MediaBrowser.Controller/Providers/DirectoryService.cs
parent8f3a6279e173dcbaaa05a56556afb410ee12dd4d (diff)
parentb9b568de13d81f9db1a8502d50940475c1d79c72 (diff)
Merge pull request #3 from MediaBrowser/master
Sync with Master
Diffstat (limited to 'MediaBrowser.Controller/Providers/DirectoryService.cs')
-rw-r--r--MediaBrowser.Controller/Providers/DirectoryService.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs
index 9d41b6d25..6f70df435 100644
--- a/MediaBrowser.Controller/Providers/DirectoryService.cs
+++ b/MediaBrowser.Controller/Providers/DirectoryService.cs
@@ -11,6 +11,7 @@ namespace MediaBrowser.Controller.Providers
{
List<FileSystemInfo> GetFileSystemEntries(string path);
IEnumerable<FileSystemInfo> GetFiles(string path);
+ IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache);
FileSystemInfo GetFile(string path);
}
@@ -27,8 +28,20 @@ namespace MediaBrowser.Controller.Providers
public List<FileSystemInfo> GetFileSystemEntries(string path)
{
+ return GetFileSystemEntries(path, false);
+ }
+
+ private List<FileSystemInfo> GetFileSystemEntries(string path, bool clearCache)
+ {
List<FileSystemInfo> entries;
+ if (clearCache)
+ {
+ List<FileSystemInfo> removed;
+
+ _cache.TryRemove(path, out removed);
+ }
+
if (!_cache.TryGetValue(path, out entries))
{
//_logger.Debug("Getting files for " + path);
@@ -50,7 +63,12 @@ namespace MediaBrowser.Controller.Providers
public IEnumerable<FileSystemInfo> GetFiles(string path)
{
- return GetFileSystemEntries(path).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory);
+ return GetFiles(path, false);
+ }
+
+ public IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache)
+ {
+ return GetFileSystemEntries(path, clearCache).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory);
}
public FileSystemInfo GetFile(string path)