CommonUtils

TheArtOfDev.HtmlRenderer.Core.Utils

Utility methods for general stuff.

Methods

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

Returns: 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

Returns: the roman number string

ConvertToGreekNumber(int) : string

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

number
the number to convert

Returns: 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

Returns: 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

Returns: 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

Returns: 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

Returns: first element or default value

GetLocalfileName(Uri) : FileInfo

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

imageUri
The online image uri.

Returns: 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

Returns: 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

Returns: A valid filename.

IsAsianCharecter(char) : bool

Check if the given char is of Asian range.

ch
the character to check

Returns: 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

Returns: 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!

Returns: 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

Returns: 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

Returns: 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

Returns: uri or null if not valid

Fields

_romanDigitsTable : string[]

Table to convert numbers into roman digits

_tempPath : string

the temp path to use for local files