View Source
Class IOHelper
Inheritance
System.Object
Assembly: Umbraco.Core.dll
Syntax
public abstract class IOHelper : IIOHelper
Constructors
View Source
IOHelper(IHostingEnvironment)
Declaration
public IOHelper(IHostingEnvironment hostingEnvironment)
Parameters
Methods
View Source
CleanFolder(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
public 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
View Source
EnsurePathExists(String)
Declaration
public void EnsurePathExists(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
View Source
FindFile(String)
Declaration
public string FindFile(string virtualPath)
Parameters
Type |
Name |
Description |
System.String |
virtualPath |
|
Returns
Type |
Description |
System.String |
|
View Source
GetRelativePath(String)
Get properly formatted relative path from an existing absolute or relative path
Declaration
public string GetRelativePath(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String |
|
View Source
GetTempFolders()
Retrieves array of temporary folders from the hosting environment.
Declaration
public DirectoryInfo[] GetTempFolders()
Returns
Type |
Description |
DirectoryInfo[] |
Array of instances.
|
View Source
IsPathFullyQualified(String)
Declaration
public virtual bool IsPathFullyQualified(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
MapPath(String)
Declaration
public string MapPath(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
Returns
Type |
Description |
System.String |
|
View Source
PathStartsWith(String, String, Char[])
Declaration
public abstract 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 |
|
View Source
ResolveUrl(String)
Declaration
public string ResolveUrl(string virtualPath)
Parameters
Type |
Name |
Description |
System.String |
virtualPath |
|
Returns
Type |
Description |
System.String |
|
View Source
VerifyEditPath(String, IEnumerable<String>)
Verifies that the current filepath matches one of several directories where the user is allowed to edit a file.
Declaration
public 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.
|
View Source
VerifyEditPath(String, String)
Verifies that the current filepath matches a directory where the user is allowed to edit a file.
Declaration
public 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.
|
View Source
VerifyFileExtension(String, IEnumerable<String>)
Verifies that the current filepath has one of several authorized extensions.
Declaration
public 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.
|