@ -1,5 +1,6 @@
using MediaBrowser.Common.IO ;
using MediaBrowser.Controller.Library ;
using MediaBrowser.Controller.Providers ;
using MediaBrowser.Model.Logging ;
using System ;
using System.Collections.Generic ;
@ -15,16 +16,16 @@ namespace MediaBrowser.Controller.IO
/// <summary>
/// Gets the filtered file system entries.
/// </summary>
/// <param name="directoryService">The directory service.</param>
/// <param name="path">The path.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="logger">The logger.</param>
/// <param name="args">The args.</param>
/// <param name="searchPattern">The search pattern.</param>
/// <param name="flattenFolderDepth">The flatten folder depth.</param>
/// <param name="resolveShortcuts">if set to <c>true</c> [resolve shortcuts].</param>
/// <returns>Dictionary{System.StringFileSystemInfo}.</returns>
/// <exception cref="System.ArgumentNullException">path</exception>
public static Dictionary < string , FileSystemInfo > GetFilteredFileSystemEntries ( string path , IFileSystem fileSystem , ILogger logger , ItemResolveArgs args , string searchPattern = "*" , int flattenFolderDepth = 0 , bool resolveShortcuts = true )
public static Dictionary < string , FileSystemInfo > GetFilteredFileSystemEntries ( IDirectoryService directoryService , string path , IFileSystem fileSystem , ILogger logger , ItemResolveArgs args , int flattenFolderDepth = 0 , bool resolveShortcuts = true )
{
if ( string . IsNullOrEmpty ( path ) )
{
@ -35,7 +36,7 @@ namespace MediaBrowser.Controller.IO
throw new ArgumentNullException ( "args" ) ;
}
var entries = new DirectoryInfo ( path ) . EnumerateFileSystemInfos ( searchPattern , SearchOption . TopDirectoryOnly ) ;
var entries = directoryService . GetFileSystemEntries ( path ) ;
if ( ! resolveShortcuts & & flattenFolderDepth = = 0 )
{
@ -79,7 +80,7 @@ namespace MediaBrowser.Controller.IO
}
else if ( flattenFolderDepth > 0 & & isDirectory )
{
foreach ( var child in GetFilteredFileSystemEntries ( fullName, fileSystem , logger , args , flattenFolderDepth : flattenFolderDepth - 1 , resolveShortcuts : resolveShortcuts ) )
foreach ( var child in GetFilteredFileSystemEntries ( directoryService, fullName, fileSystem , logger , args , flattenFolderDepth : flattenFolderDepth - 1 , resolveShortcuts : resolveShortcuts ) )
{
dict [ child . Key ] = child . Value ;
}