C# Класс Utilities.FileUtilities

Utility class providing a collection of static utility methods.
Показать файл Открыть проект

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

Метод Описание
ConvertWildcardPatternToRE ( string pattern ) : Regex

Converts a pattern containing ? and * characters into a case- insensitive regular expression.

EnsureDirExists ( string path ) : void

Checks if the specified directory exists, throwing an exception if it doesn't.

EnsureFileExists ( string path ) : void

Checks if the specified path exists, throwing an exception if it doesn't.

EnsureFileWriteable ( string path ) : void

Checks if the specified path can be written to.

FindMatchingFiles ( string sourceDir, string namePattern, bool includeSubDirs ) : List

Given a starting directory and a filename pattern, returns a list paths of files that match the name pattern.

GetBytes ( string str ) : byte[]

Convert a string to a byte array, using ASCII encoding.

GetDirectoryName ( string path ) : string

Returns the name of the directory, given a path to a directory

GetMatchingFiles ( string pathPattern ) : List

Given a path containing wildcards, returns the file(s) that match pattern.

PathDifference ( string path1, string path2 ) : string

Returns the part of path2 that is not in path1.

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

Метод Описание
FindMatchingFiles ( string sourceDir, Regex nameRE, bool includeSubDirs, int depth ) : List

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

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

Converts a pattern containing ? and * characters into a case- insensitive regular expression.
public static ConvertWildcardPatternToRE ( string pattern ) : Regex
pattern string
Результат System.Text.RegularExpressions.Regex

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

Checks if the specified directory exists, throwing an exception if it doesn't.
public static EnsureDirExists ( string path ) : void
path string
Результат void

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

Checks if the specified path exists, throwing an exception if it doesn't.
public static EnsureFileExists ( string path ) : void
path string
Результат void

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

Checks if the specified path can be written to.
public static EnsureFileWriteable ( string path ) : void
path string
Результат void

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

Given a starting directory and a filename pattern, returns a list paths of files that match the name pattern.
public static FindMatchingFiles ( string sourceDir, string namePattern, bool includeSubDirs ) : List
sourceDir string
namePattern string
includeSubDirs bool
Результат List

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

Convert a string to a byte array, using ASCII encoding.
public static GetBytes ( string str ) : byte[]
str string
Результат byte[]

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

Returns the name of the directory, given a path to a directory
public static GetDirectoryName ( string path ) : string
path string
Результат string

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

Given a path containing wildcards, returns the file(s) that match pattern.
public static GetMatchingFiles ( string pathPattern ) : List
pathPattern string
Результат List

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

Returns the part of path2 that is not in path1.
public static PathDifference ( string path1, string path2 ) : string
path1 string
path2 string
Результат string