Interface IIOHelper
Namespace: Umbraco.Cms.Core.IO
Assembly: Umbraco.Core.dll
Syntax
public interface IIOHelperMethods
View SourceCleanFolder(DirectoryInfo, TimeSpan)
Cleans contents of a folder by deleting all files older that the provided age. If deletition of any file errors (e.g. due to a file lock) the process will continue to try to delete all that it can.
Declaration
CleanFolderResult CleanFolder(DirectoryInfo folder, TimeSpan age)Parameters
| Type | Name | Description | 
|---|---|---|
| DirectoryInfo | folder | Folder to clean. | 
| TimeSpan | age | Age of files within folder to delete. | 
Returns
| Type | Description | 
|---|---|
| CleanFolderResult | Result of operation | 
EnsurePathExists(String)
Declaration
void EnsurePathExists(string path)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | path | 
FindFile(String)
Declaration
string FindFile(string virtualPath)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | virtualPath | 
Returns
| Type | Description | 
|---|---|
| System.String | 
GetRelativePath(String)
Get properly formatted relative path from an existing absolute or relative path
Declaration
string GetRelativePath(string path)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | path | 
Returns
| Type | Description | 
|---|---|
| System.String | 
GetTempFolders()
Retrieves array of temporary folders from the hosting environment.
Declaration
DirectoryInfo[] GetTempFolders()Returns
| Type | Description | 
|---|---|
| DirectoryInfo[] | Array of  | 
MapPath(String)
Maps a virtual path to a physical path in the content root folder (i.e. www)
Declaration
string MapPath(string path)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | path | 
Returns
| Type | Description | 
|---|---|
| System.String | 
PathStartsWith(String, String, Char[])
Declaration
bool PathStartsWith(string path, string root, params char[] separators)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | path | |
| System.String | root | |
| System.Char[] | separators | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
ResolveUrl(String)
Declaration
string ResolveUrl(string virtualPath)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | virtualPath | 
Returns
| Type | Description | 
|---|---|
| System.String | 
VerifyEditPath(String, IEnumerable<String>)
Verifies that the current filepath matches one of several directories where the user is allowed to edit a file.
Declaration
bool VerifyEditPath(string filePath, IEnumerable<string> validDirs)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | filePath | The filepath to validate. | 
| IEnumerable<System.String> | validDirs | The valid directories. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | A value indicating whether the filepath is valid. | 
VerifyEditPath(String, String)
Verifies that the current filepath matches a directory where the user is allowed to edit a file.
Declaration
bool VerifyEditPath(string filePath, string validDir)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | filePath | The filepath to validate. | 
| System.String | validDir | The valid directory. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | A value indicating whether the filepath is valid. | 
VerifyFileExtension(String, IEnumerable<String>)
Verifies that the current filepath has one of several authorized extensions.
Declaration
bool VerifyFileExtension(string filePath, IEnumerable<string> validFileExtensions)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | filePath | The filepath to validate. | 
| IEnumerable<System.String> | validFileExtensions | The valid extensions. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | A value indicating whether the filepath is valid. |