1
- // Copyright (c) Microsoft Corporation
1
+ // Copyright (c) Microsoft Corporation
2
2
// The Microsoft Corporation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
@@ -12,23 +12,27 @@ namespace Microsoft.Plugin.Folder.Sources
12
12
public class QueryFileSystemInfo : IQueryFileSystemInfo
13
13
{
14
14
private readonly IDirectoryInfoFactory _directoryInfoFactory ;
15
+ private readonly MatchType _matchType ;
16
+ private readonly FileAttributes _attributesToSkip ;
15
17
16
- public QueryFileSystemInfo ( IDirectoryInfoFactory directoryInfoFactory )
18
+ public QueryFileSystemInfo ( IDirectoryInfoFactory directoryInfoFactory , MatchType matchType = MatchType . Win32 , FileAttributes attributesToSkip = FileAttributes . Hidden )
17
19
{
18
20
_directoryInfoFactory = directoryInfoFactory ;
21
+ _matchType = matchType ;
22
+ _attributesToSkip = attributesToSkip ;
19
23
}
20
24
21
25
public IEnumerable < DisplayFileInfo > MatchFileSystemInfo ( string search , string incompleteName , bool isRecursive )
22
26
{
23
27
// search folder and add results
24
28
var directoryInfo = _directoryInfoFactory . FromDirectoryName ( search ) ;
25
- var fileSystemInfos = directoryInfo . EnumerateFileSystemInfos ( incompleteName , new EnumerationOptions ( )
29
+ var fileSystemInfos = directoryInfo . EnumerateFileSystemInfos ( incompleteName , new EnumerationOptions
26
30
{
27
- MatchType = MatchType . Win32 ,
31
+ MatchType = _matchType ,
28
32
RecurseSubdirectories = isRecursive ,
29
33
IgnoreInaccessible = true ,
30
34
ReturnSpecialDirectories = false ,
31
- AttributesToSkip = FileAttributes . Hidden ,
35
+ AttributesToSkip = _attributesToSkip ,
32
36
MatchCasing = MatchCasing . PlatformDefault ,
33
37
} ) ;
34
38
0 commit comments