| File: Internal\PhysicalDirectoryContents.cs | Web Access |
| Project: src\runtime\src\libraries\Microsoft.Extensions.FileProviders.Physical\src\Microsoft.Extensions.FileProviders.Physical.csproj (Microsoft.Extensions.FileProviders.Physical) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections; using System.Collections.Generic; using System.IO; using Microsoft.Extensions.FileProviders.Physical; namespace Microsoft.Extensions.FileProviders.Internal { /// <summary> /// Represents the contents of a physical file directory. /// </summary> public class PhysicalDirectoryContents : IDirectoryContents { private readonly PhysicalDirectoryInfo _info; /// <summary> /// Initializes a new instance of the <see cref="PhysicalDirectoryContents"/> class. /// </summary> /// <param name="directory">The directory to represent.</param> public PhysicalDirectoryContents(string directory) : this(directory, ExclusionFilters.Sensitive) { } /// <summary> /// Initializes a new instance of the <see cref="PhysicalDirectoryContents"/> class. /// </summary> /// <param name="directory">The directory to represent.</param> /// <param name="filters">A bitwise combination of the enumeration values that specifies which files or directories are excluded from enumeration.</param> public PhysicalDirectoryContents(string directory, ExclusionFilters filters) { ArgumentNullException.ThrowIfNull(directory); _info = new PhysicalDirectoryInfo(new DirectoryInfo(directory), filters); } /// <inheritdoc/> public bool Exists => _info.Exists; /// <inheritdoc/> public IEnumerator<IFileInfo> GetEnumerator() => _info.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => _info.GetEnumerator(); } }