Class Directory
- Namespace
- Kentico.Xperience.AzureStorage
- Assembly
- Kentico.Xperience.AzureStorage.dll
Implementation of Directory provider for Azure.
public class Directory : AbstractDirectory
- Inheritance
-
objectDirectory
- Inherited Members
- Extension Methods
Constructors
Directory()
Initializes a new instance of the Directory class, which provides operations with directories.
public Directory()
Methods
CreateDirectory(string)
Creates all directories and subdirectories as specified by path.
public override DirectoryInfo CreateDirectory(string path)
Parameters
pathstringPath to create.
Returns
Exceptions
- PathTooLongException
pathis too long- ArgumentException
pathcontains invalid characters
CreateDirectoryStructure(string)
Creates directory structure for given path.
[Obsolete("Method not intended for public use")]
public static void CreateDirectoryStructure(string path)
Parameters
pathstringPath with temporary file.
Delete(string)
Deletes an empty directory.
public override void Delete(string path)
Parameters
pathstringPath to directory
Exceptions
- PathTooLongException
pathis too long- ArgumentException
pathcontains invalid characters
Delete(string, bool)
Deletes an empty directory and, if indicated, any subdirectories and files in the directory.
public override void Delete(string path, bool recursive)
Parameters
pathstringPath to directory
recursiveboolDelete if subdirs exists.
Exceptions
- PathTooLongException
pathis too long- ArgumentException
pathcontains invalid characters- DirectoryNotFoundException
pathdoes not exist
DeleteDirectoryStructure(string)
Deletes all files in the directory structure. It works also in a shared hosting environment.
public override void DeleteDirectoryStructure(string path)
Parameters
pathstringFull path of the directory to delete
EnumerateDirectories(string, string, SearchOption)
Returns an enumerable collection of directory names that match a search pattern in a specified path, and optionally searches subdirectories.
public override IEnumerable<string> EnumerateDirectories(string path, string searchPattern, SearchOption searchOption)
Parameters
pathstringThe relative or absolute path to the directory to search. This string is not case-sensitive.
searchPatternstringSearch pattern.
searchOptionSearchOptionOne of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories.
Returns
- IEnumerable<string>
An enumerable collection of the full names (including paths) for the directories in the directory specified by
pathand that match the specified search pattern and option.
Exceptions
- PathTooLongException
pathis too long- ArgumentException
pathcontains invalid characters
EnumerateFiles(string, string)
Returns an enumerable collection of file names that match a search pattern in a specified path.
public override IEnumerable<string> EnumerateFiles(string path, string searchPattern)
Parameters
pathstringThe relative or absolute path to the directory to search. This string is not case-sensitive.
searchPatternstringSearch pattern.
Returns
- IEnumerable<string>
An enumerable collection of the full names (including paths) for the files in the directory specified by
pathand that match the specified search pattern.
Exceptions
- PathTooLongException
pathis too long- ArgumentException
pathcontains invalid characters
Exists(string)
Determines whether the given path refers to an existing directory on disk.
public override bool Exists(string path)
Parameters
pathstringPath to test.
Returns
- bool
ExistsInBlobStorage(string)
Determines whether the given path refers to an existing directory on azure blob.
public static bool ExistsInBlobStorage(string path)
Parameters
pathstringPath to test.
Returns
- bool
ExistsInFileSystem(string)
Determines whether the given path refers to an existing directory on filesystem
public static bool ExistsInFileSystem(string path)
Parameters
pathstringPath to test.
Returns
- bool
GetBlobPathFromPath(string, bool?)
Returns blob path from given file system path. Returns relative path with slashes '/' from the root of the blob storage.
public static string GetBlobPathFromPath(string path, bool? caseSensitive = null)
Parameters
pathstringPath
caseSensitivebool?Case sensitive.
Returns
- string
GetCaseValidPath(string, bool?)
Returns lowered path if given container if not case sensitive. Otherwise method returns original path.
public static string GetCaseValidPath(string path, bool? caseSensitive = null)
Parameters
pathstringPath to modify.
caseSensitivebool?Indicates whether path is case sensitive
Returns
- string
GetDirectories(string, string, SearchOption)
Gets the names of the subdirectories (including their paths) that match the specified search pattern in the current directory, and optionally searches subdirectories.
public override string[] GetDirectories(string path, string searchPattern, SearchOption searchOption)
Parameters
pathstringThe relative or absolute path to the directory to search. This string is not case-sensitive.
searchPatternstringSearch pattern.
searchOptionSearchOptionOne of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.
Returns
- string[]
An array of the full names (including paths) of the subdirectories that match the specified criteria, or an empty array if no directories are found.
Exceptions
- PathTooLongException
pathis too long- ArgumentException
pathcontains invalid characters
GetFiles(string, string)
Returns the names of files (including their paths) that match the specified search pattern in the specified directory.
public override string[] GetFiles(string path, string searchPattern)
Parameters
pathstringThe relative or absolute path to the directory to search. This string is not case-sensitive.
searchPatternstringSearch pattern.
Returns
- string[]
An array of the full names (including paths) for the files in the specified directory that match the specified search pattern, or an empty array if no files are found.
Exceptions
- PathTooLongException
pathis too long- ArgumentException
pathcontains invalid characters
GetPathFromUri(Uri, bool, string)
Returns system path from URI and container name.
public static string GetPathFromUri(Uri uri, bool absolute, string containerName = null)
Parameters
uriUriUri.
absoluteboolIf path should be absolute.
containerNamestringContainer name.
Returns
- string
Absolute path.
GetValidPath(string, bool?)
Converts path to valid and lower case.
public static string GetValidPath(string path, bool? caseSensitive = null)
Parameters
pathstringPath to modify.
caseSensitivebool?Case sensitive.
Returns
- string
Move(string, string)
Moves directory.
public override void Move(string sourceDirName, string destDirName)
Parameters
sourceDirNamestringSource directory name.
destDirNamestringDestination directory name.
Exceptions
- PathTooLongException
sourceDirNameordestDirNameis too long- ArgumentException
sourceDirNameordestDirNamecontains invalid characters- IOException
sourceDirNamedoes not exist ordestDirNamealready exists
PrepareFilesForImport(string)
Prepares files for import. Converts them to media library.
[Obsolete("Method was not intended for public use and will be removed in the next version.")]
public override void PrepareFilesForImport(string path)
Parameters
pathstringPath.