diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-03 23:38:46 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-03 23:38:46 -0400 |
| commit | 8ad702060ea31a3862598056509a2597f6a2b639 (patch) | |
| tree | 0ff47fe50567456746ebe028599f6dd54b52f6ab /MediaBrowser.Controller/Providers/DirectoryService.cs | |
| parent | 64c1628160d31482d6b74fd82a6dfd0c9cf5de96 (diff) | |
begin file system rework
Diffstat (limited to 'MediaBrowser.Controller/Providers/DirectoryService.cs')
| -rw-r--r-- | MediaBrowser.Controller/Providers/DirectoryService.cs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index d320409f48..6890b7a7c7 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -13,8 +13,8 @@ namespace MediaBrowser.Controller.Providers private readonly ILogger _logger; private readonly IFileSystem _fileSystem; - private readonly ConcurrentDictionary<string, Dictionary<string,FileSystemInfo>> _cache = - new ConcurrentDictionary<string, Dictionary<string, FileSystemInfo>>(StringComparer.OrdinalIgnoreCase); + private readonly ConcurrentDictionary<string, Dictionary<string, FileSystemMetadata>> _cache = + new ConcurrentDictionary<string, Dictionary<string, FileSystemMetadata>>(StringComparer.OrdinalIgnoreCase); public DirectoryService(ILogger logger, IFileSystem fileSystem) { @@ -27,28 +27,28 @@ namespace MediaBrowser.Controller.Providers { } - public IEnumerable<FileSystemInfo> GetFileSystemEntries(string path) + public IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path) { return GetFileSystemEntries(path, false); } - public Dictionary<string, FileSystemInfo> GetFileSystemDictionary(string path) + public Dictionary<string, FileSystemMetadata> GetFileSystemDictionary(string path) { return GetFileSystemDictionary(path, false); } - private Dictionary<string, FileSystemInfo> GetFileSystemDictionary(string path, bool clearCache) + private Dictionary<string, FileSystemMetadata> GetFileSystemDictionary(string path, bool clearCache) { if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentNullException("path"); } - Dictionary<string, FileSystemInfo> entries; + Dictionary<string, FileSystemMetadata> entries; if (clearCache) { - Dictionary<string, FileSystemInfo> removed; + Dictionary<string, FileSystemMetadata> removed; _cache.TryRemove(path, out removed); } @@ -57,7 +57,7 @@ namespace MediaBrowser.Controller.Providers { //_logger.Debug("Getting files for " + path); - entries = new Dictionary<string, FileSystemInfo>(StringComparer.OrdinalIgnoreCase); + entries = new Dictionary<string, FileSystemMetadata>(StringComparer.OrdinalIgnoreCase); try { @@ -82,34 +82,34 @@ namespace MediaBrowser.Controller.Providers return entries; } - private IEnumerable<FileSystemInfo> GetFileSystemEntries(string path, bool clearCache) + private IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool clearCache) { return GetFileSystemDictionary(path, clearCache).Values; } - public IEnumerable<FileSystemInfo> GetFiles(string path) + public IEnumerable<FileSystemMetadata> GetFiles(string path) { return GetFiles(path, false); } - public IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache) + public IEnumerable<FileSystemMetadata> GetFiles(string path, bool clearCache) { return GetFileSystemEntries(path, clearCache).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory); } - public FileSystemInfo GetFile(string path) + public FileSystemMetadata GetFile(string path) { var directory = Path.GetDirectoryName(path); var dict = GetFileSystemDictionary(directory, false); - FileSystemInfo entry; + FileSystemMetadata entry; dict.TryGetValue(path, out entry); return entry; } - public IEnumerable<FileSystemInfo> GetDirectories(string path) + public IEnumerable<FileSystemMetadata> GetDirectories(string path) { return GetFileSystemEntries(path, false).Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory); } |
