C# Класс CsQuery.Utility.Support

Some static methods that didn't fit in anywhere else.
Показать файл Открыть проект Примеры использования класса

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

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

Convert slashes to backslashes; make sure there's one (or zero, if not rooted) leading or trailing backslash; resolve parent and current folder references. Missing values are returned as just one backslash.

CombinePaths ( string path1, string path2 ) : string

Combine two file paths, normalizing slashes and eliminating any relative path markers.

CopyFiles ( DirectoryInfo source, DirectoryInfo destination ) : void

Copies files matching a pattern. Existing files will be overwritten.

CopyFiles ( DirectoryInfo source, DirectoryInfo destination, bool overwrite ) : void

Copies files matching a pattern.

DeleteFiles ( DirectoryInfo directory ) : void

Deletes the files in a directory matching one or more patterns (nonrecursive)

DoubleOrZero ( string value ) : double

Convert a string value to a double, or zero if non-numeric

EnumToAttribute ( Enum value ) : string

Convert an enum to a lowercased attribute value

FromCamelCase ( string name ) : string

Given a string, convert each uppercase letter to a "-" followed by the lower case letter. E.g. "fontSize" becomes "font-size".

GetEncodedStream ( string html, Encoding encoding ) : Stream

Return a stream, including BOM preamble, from a string

GetFirstExternalAssembly ( ) : Assembly

Gets the first assembly that is not the assembly that this method belongs to

GetResourceStream ( string resourceName ) : Stream

Gets a resource from the calling assembly

GetResourceStream ( string resourceName, Assembly assembly ) : Stream

Gets a resource name using the assembly and resource name

GetResourceStream ( string resourceName, string assembly ) : Stream

Gets an embedded resource from an assembly by name

IntOrZero ( string value ) : int

Convert a string value to an integer, or zero if non-numeric

MethodPath ( MemberInfo mi ) : string

Get a fully qualified namespaced path to a member

MethodPath ( Type type, string memberName ) : string

Get a fully qualified namespaced path to a member.

NumberToDoubleOrInt ( IConvertible value ) : IConvertible

Return an int or double from any number.

StreamToCharArray ( Stream stream ) : char[]

Conver a stream to a character array.

StreamToString ( Stream stream ) : string

Convert a string to a stream using ASCII encoding.

TypePath ( Type type ) : string

Get a fully qualified namespaced path to a type, e.g. "CsQuery.Utility.Support.TypePath"

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

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

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

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

Convert slashes to backslashes; make sure there's one (or zero, if not rooted) leading or trailing backslash; resolve parent and current folder references. Missing values are returned as just one backslash.
public static CleanFilePath ( string path ) : string
path string /// The path to clean ///
Результат string

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

Combine two file paths, normalizing slashes and eliminating any relative path markers.
public static CombinePaths ( string path1, string path2 ) : string
path1 string /// The first path. ///
path2 string /// The second path. ///
Результат string

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

Copies files matching a pattern. Existing files will be overwritten.
public static CopyFiles ( DirectoryInfo source, DirectoryInfo destination ) : void
source System.IO.DirectoryInfo /// Source directory for the files ///
destination System.IO.DirectoryInfo /// Destination directory. ///
Результат void

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

Copies files matching a pattern.
/// Thrown when one or more arguments have unsupported or illegal values. ///
public static CopyFiles ( DirectoryInfo source, DirectoryInfo destination, bool overwrite ) : void
source System.IO.DirectoryInfo /// Source for the. ///
destination System.IO.DirectoryInfo /// Destination for the. ///
overwrite bool /// true to overwrite, false to preserve. ///
Результат void

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

Deletes the files in a directory matching one or more patterns (nonrecursive)
/// Thrown when the directory is missing ///
public static DeleteFiles ( DirectoryInfo directory ) : void
directory System.IO.DirectoryInfo /// Directory where files are located. ///
Результат void

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

Convert a string value to a double, or zero if non-numeric
public static DoubleOrZero ( string value ) : double
value string /// The value. ///
Результат double

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

Convert an enum to a lowercased attribute value
public static EnumToAttribute ( Enum value ) : string
value System.Enum /// The value. ///
Результат string

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

Given a string, convert each uppercase letter to a "-" followed by the lower case letter. E.g. "fontSize" becomes "font-size".
public static FromCamelCase ( string name ) : string
name string /// The string to uncamelcase ///
Результат string

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

Return a stream, including BOM preamble, from a string
public static GetEncodedStream ( string html, Encoding encoding ) : Stream
html string /// The HTML. ///
encoding System.Text.Encoding /// The encoding. ///
Результат Stream

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

Gets the first assembly that is not the assembly that this method belongs to
/// Thrown when the requested operation is invalid. ///
public static GetFirstExternalAssembly ( ) : Assembly
Результат System.Reflection.Assembly

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

Gets a resource from the calling assembly
public static GetResourceStream ( string resourceName ) : Stream
resourceName string
Результат Stream

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

Gets a resource name using the assembly and resource name
public static GetResourceStream ( string resourceName, Assembly assembly ) : Stream
resourceName string
assembly System.Reflection.Assembly
Результат Stream

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

Gets an embedded resource from an assembly by name
public static GetResourceStream ( string resourceName, string assembly ) : Stream
resourceName string /// The resource name ///
assembly string /// The assembly name ///
Результат Stream

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

Convert a string value to an integer, or zero if non-numeric
public static IntOrZero ( string value ) : int
value string /// The value. ///
Результат int

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

Get a fully qualified namespaced path to a member
public static MethodPath ( MemberInfo mi ) : string
mi System.Reflection.MemberInfo
Результат string

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

Get a fully qualified namespaced path to a member.
public static MethodPath ( Type type, string memberName ) : string
type System.Type /// The type to inspect. ///
memberName string /// Name of the member. ///
Результат string

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

Return an int or double from any number.
public static NumberToDoubleOrInt ( IConvertible value ) : IConvertible
value IConvertible /// The number to convert ///
Результат IConvertible

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

Conver a stream to a character array.
public static StreamToCharArray ( Stream stream ) : char[]
stream Stream /// The stream. ///
Результат char[]

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

Convert a string to a stream using ASCII encoding.
public static StreamToString ( Stream stream ) : string
stream Stream /// The stream. ///
Результат string

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

Get a fully qualified namespaced path to a type, e.g. "CsQuery.Utility.Support.TypePath"
public static TypePath ( Type type ) : string
type System.Type /// The type to inspect ///
Результат string