C# Класс Catel.IO.Path

Static class that implements some path methods
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AppendTrailingSlash ( string path ) : string

Appends a trailing backslash (\) to the path.

AppendTrailingSlash ( string path, char slash ) : string

Appends a trailing slash (\ or /) to the path.

Combine ( ) : string

Returns a combination of multiple paths.

CombineUrls ( ) : string

Returns a combination of multiple urls.

GetApplicationDataDirectory ( ) : string

Gets the application data directory for the company and product as defined the the assembly information of the entry assembly. If the entry assembly is null, this method will fall back to the calling assembly to retrieve the information. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].

GetApplicationDataDirectory ( ApplicationDataTarget applicationDataTarget ) : string

Gets the application data directory for the company and product as defined the the assembly information of the entry assembly. If the entry assembly is null, this method will fall back to the calling assembly to retrieve the information. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].

GetApplicationDataDirectory ( ApplicationDataTarget applicationDataTarget, string productName ) : string

Gets the application data directory for a specific product. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[product name].

GetApplicationDataDirectory ( ApplicationDataTarget applicationDataTarget, string companyName, string productName ) : string

Gets the application data directory for a specific product of a specific company. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].

GetApplicationDataDirectory ( string productName ) : string

Gets the application data directory for a specific product. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[product name].

GetApplicationDataDirectory ( string companyName, string productName ) : string

Gets the application data directory for a specific product of a specific company. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].

GetApplicationDataDirectoryForAllUsers ( ) : string

Gets the application data directory for the company and product as defined the the assembly information of the entry assembly. If the entry assembly is null, this method will fall back to the calling assembly to retrieve the information. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].

GetApplicationDataDirectoryForAllUsers ( string productName ) : string

Gets the application data directory for a specific product. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[product name].

GetApplicationDataDirectoryForAllUsers ( string companyName, string productName ) : string

Gets the application data directory for a specific product of a specific company. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].

GetDirectoryName ( string path ) : string

Gets the name of the directory.

GetFileName ( string path ) : string

Gets the name of the file.

GetFullPath ( string relativePath, string basePath ) : string

Returns the full path for a relative path.

GetParentDirectory ( string path ) : string

Gets the parent directory.

This method will always strip the trailing backslash from the parent.

GetRelativePath ( string fullPath, string basePath = null ) : string

Returns a relative path string from a full path. The path to convert. Can be either a file or a directory The base path to truncate to and replace Lower case string of the relative path. If path is a directory it's returned without a backslash at the end. Examples of returned values: .\test.txt, ..\test.txt, ..\..\..\test.txt, ., ..

Приватные методы

Метод Описание
RemoveStartAndTrailingSlashes ( string value ) : string

Removes any slashes (\ or /) at the beginning and end of the string.

RemoveStartSlashes ( string value ) : string

Removes any slashes (\ or /) at the beginning of the string.

RemoveTrailingSlashes ( string value ) : string

Removes any slashes (\ or /) at the end of the string.

ReplacePathSlashesByUrlSlashes ( string value ) : string

Replaces path slashes (\) by url slashes (/).

Описание методов

AppendTrailingSlash() публичный статический Метод

Appends a trailing backslash (\) to the path.
The is null or whitespace.
public static AppendTrailingSlash ( string path ) : string
path string Path to append the trailing backslash to.
Результат string

AppendTrailingSlash() публичный статический Метод

Appends a trailing slash (\ or /) to the path.
The is null or whitespace.
public static AppendTrailingSlash ( string path, char slash ) : string
path string Path to append the trailing slash to.
slash char Slash to append (\ or /).
Результат string

Combine() публичный статический Метод

Returns a combination of multiple paths.
public static Combine ( ) : string
Результат string

CombineUrls() публичный статический Метод

Returns a combination of multiple urls.
public static CombineUrls ( ) : string
Результат string

GetApplicationDataDirectory() публичный статический Метод

Gets the application data directory for the company and product as defined the the assembly information of the entry assembly. If the entry assembly is null, this method will fall back to the calling assembly to retrieve the information. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].
public static GetApplicationDataDirectory ( ) : string
Результат string

GetApplicationDataDirectory() публичный статический Метод

Gets the application data directory for the company and product as defined the the assembly information of the entry assembly. If the entry assembly is null, this method will fall back to the calling assembly to retrieve the information. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].
public static GetApplicationDataDirectory ( ApplicationDataTarget applicationDataTarget ) : string
applicationDataTarget ApplicationDataTarget
Результат string

GetApplicationDataDirectory() публичный статический Метод

Gets the application data directory for a specific product. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[product name].
public static GetApplicationDataDirectory ( ApplicationDataTarget applicationDataTarget, string productName ) : string
applicationDataTarget ApplicationDataTarget The application data target.
productName string Name of the product.
Результат string

GetApplicationDataDirectory() публичный статический Метод

Gets the application data directory for a specific product of a specific company. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].
public static GetApplicationDataDirectory ( ApplicationDataTarget applicationDataTarget, string companyName, string productName ) : string
applicationDataTarget ApplicationDataTarget The application data target.
companyName string Name of the company.
productName string Name of the product.
Результат string

GetApplicationDataDirectory() публичный статический Метод

Gets the application data directory for a specific product. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[product name].
public static GetApplicationDataDirectory ( string productName ) : string
productName string Name of the product.
Результат string

GetApplicationDataDirectory() публичный статический Метод

Gets the application data directory for a specific product of a specific company. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].
public static GetApplicationDataDirectory ( string companyName, string productName ) : string
companyName string Name of the company.
productName string Name of the product.
Результат string

GetApplicationDataDirectoryForAllUsers() публичный статический Метод

Gets the application data directory for the company and product as defined the the assembly information of the entry assembly. If the entry assembly is null, this method will fall back to the calling assembly to retrieve the information. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].
public static GetApplicationDataDirectoryForAllUsers ( ) : string
Результат string

GetApplicationDataDirectoryForAllUsers() публичный статический Метод

Gets the application data directory for a specific product. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[product name].
public static GetApplicationDataDirectoryForAllUsers ( string productName ) : string
productName string Name of the product.
Результат string

GetApplicationDataDirectoryForAllUsers() публичный статический Метод

Gets the application data directory for a specific product of a specific company. If the folder does not exist, the folder is automatically created by this method. This method returns a value like [application data]\[company]\[product name].
public static GetApplicationDataDirectoryForAllUsers ( string companyName, string productName ) : string
companyName string Name of the company.
productName string Name of the product.
Результат string

GetDirectoryName() публичный статический Метод

Gets the name of the directory.
The is null or whitespace.
public static GetDirectoryName ( string path ) : string
path string The path to get the directory name from.
Результат string

GetFileName() публичный статический Метод

Gets the name of the file.
The is null or whitespace.
public static GetFileName ( string path ) : string
path string The path to get the file name from.
Результат string

GetFullPath() публичный статический Метод

Returns the full path for a relative path.
The is null or whitespace. The is null or whitespace.
public static GetFullPath ( string relativePath, string basePath ) : string
relativePath string Relative path to convert to a full path.
basePath string Base path (a.k.a. working directory).
Результат string

GetParentDirectory() публичный статический Метод

Gets the parent directory.
This method will always strip the trailing backslash from the parent.
public static GetParentDirectory ( string path ) : string
path string The path to get the parent directory from.
Результат string

GetRelativePath() публичный статический Метод

Returns a relative path string from a full path. The path to convert. Can be either a file or a directory The base path to truncate to and replace Lower case string of the relative path. If path is a directory it's returned without a backslash at the end. Examples of returned values: .\test.txt, ..\test.txt, ..\..\..\test.txt, ., ..
The is null or whitespace.
public static GetRelativePath ( string fullPath, string basePath = null ) : string
fullPath string Full path to convert to relative path.
basePath string The base path (a.k.a. working directory). If this parameter is null or empty, the current working directory will be used.
Результат string