CommonUtils

TheArtOfDev.HtmlRenderer.Core.Utils

Utility methods for general stuff.

方法

ConvertToAlphaNumber(int, string) : string

Convert number to alpha numeric system by the requested style (UpperAlpha, LowerRoman, Hebrew, etc.).

number
the number to convert
style
the css style to convert by

返回值: converted string

ConvertToEnglishNumber(int, bool) : string

Convert the given integer into alphabetic numeric format (D, AU, etc.)

number
the number to convert
lowercase
is to use lowercase

返回值: the roman number string

ConvertToGreekNumber(int) : string

Convert the given integer into alphabetic numeric format (alpha, AU, etc.)

number
the number to convert

返回值: the roman number string

ConvertToRomanNumbers(int, bool) : string

Convert the given integer into roman numeric format (II, VI, IX, etc.)

number
the number to convert
lowercase
if to use lowercase letters for roman digits

返回值: the roman number string

ConvertToSpecificNumbers(int, String[0:,0:]) : string

Convert the given integer into given alphabet numeric system.

number
the number to convert
alphabet
the alphabet system to use

返回值: the number string

ConvertToSpecificNumbers2(int, string[]) : string

Convert the given integer into given alphabet numeric system.

number
the number to convert
alphabet
the alphabet system to use

返回值: the number string

GetFirstValueOrDefault``2(IDictionary<T, T>, T)

Get the first value in the given dictionary.

dic
the dictionary
defaultValue
optional: the default value to return of no elements found in dictionary

返回值: first element or default value

GetLocalfileName(Uri) : FileInfo

Gets the representation of the online uri on the local disk.

imageUri
The online image uri.

返回值: The path of the file on the disk.

GetNextSubString(string, int, int) : int

Get substring separated by whitespace starting from the given idex.

str
the string to get substring in
idx
the index to start substring search from
length
return the length of the found string

返回值: the index of the substring, -1 if no valid sub-string found

GetValidFileName(string) : string

Replaces invalid filename chars to '_'

source
The possibly-not-valid filename

返回值: A valid filename.

IsAsianCharecter(char) : bool

Check if the given char is of Asian range.

ch
the character to check

返回值: true - Asian char, false - otherwise

IsDigit(char, bool) : bool

Check if the given char is a digit character (0-9) and (0-9, a-f for HEX)

ch
the character to check
hex
optional: is hex digit check

返回值: true - is digit, false - not a digit

Max(RSize, RSize) : RSize

Get size that is max of and for width and height separately.

SubStringEquals(string, int, int, string) : bool

Compare that the substring of is equal to Assume given substring is not empty and all indexes are valid!

返回值: true - equals, false - not equals

ToDigit(char, bool) : int

Convert the given char to digit.

ch
the character to check
hex
optional: is hex digit check

返回值: true - is digit, false - not a digit

TryGetFileInfo(string) : FileInfo

Get file info object for the given path if it is valid file path.

path
the path to get file info for

返回值: file info or null if not valid

TryGetUri(string) : Uri

Get Uri object for the given path if it is valid uri path.

path
the path to get uri for

返回值: uri or null if not valid

字段

_romanDigitsTable : string[]

Table to convert numbers into roman digits

_tempPath : string

the temp path to use for local files