Table of Contents

Class FileProviderExtensions

Namespace
Kentico.Content.Web.Mvc
Assembly
Kentico.Content.Web.Mvc.dll

Provides additional methods for Microsoft.Extensions.FileProviders.IFileProvider objects.

public static class FileProviderExtensions
Inheritance
object
FileProviderExtensions

Methods

EnumerateFiles(IFileProvider, string, string, bool)

Returns an enumerable collection of file name in the directory.

public static IEnumerable<string> EnumerateFiles(this IFileProvider fileProvider, string basePath, string searchPattern, bool searchSubdirectories)

Parameters

fileProvider IFileProvider

The Microsoft.Extensions.FileProviders.IFileProvider object.

basePath string

The directory to enumerate files.

searchPattern string

The search pattern to use in selecting files to enumeration.

searchSubdirectories bool

Specifies whether to recursively enumerate subdirectories of basePath.

Returns

IEnumerable<string>

EnumerateFiles(IFileProvider, string, Regex, bool)

Returns an enumerable collection of file name in the directory.

public static IEnumerable<string> EnumerateFiles(this IFileProvider fileProvider, string basePath, Regex pattern, bool searchSubdirectories)

Parameters

fileProvider IFileProvider

The Microsoft.Extensions.FileProviders.IFileProvider object.

basePath string

The directory to enumerate files.

pattern Regex

The regular expression pattern to use in selecting files to enumeration.

searchSubdirectories bool

Specifies whether to recursively enumerate subdirectories of basePath.

Returns

IEnumerable<string>

SanitizedPath(IFileProvider, string, char, string)

Replaces path separators in file name with newDirectorySeparatorChar.

public static string SanitizedPath(this IFileProvider _, string fileName, char newDirectorySeparatorChar, string pathPrefix)

Parameters

_ IFileProvider

Extension point.

fileName string

Original file name.

newDirectorySeparatorChar char

New path delimiter.

pathPrefix string

Optional new file prefix folder.

Returns

string