Skip to content

Latest commit

 

History

History
2308 lines (2163 loc) · 77.7 KB

Atc.Helpers.md

File metadata and controls

2308 lines (2163 loc) · 77.7 KB

Atc.Helpers


ArticleNumberHelper

BarcodeHelper.

Remarks: https://en.wikipedia.org/wiki/International_Article_Number.

public static class ArticleNumberHelper

Static Methods

GetArticleNumberType

ArticleNumberType GetArticleNumberType(string articleNumber)

Summary: Get ArticleNumberType.

Parameters:
     articleNumber  -  ASIN, EAN8, EAN13, GTIN, ISBN10, ISBN13, UPC.

IsValidAsin

bool IsValidAsin(string asin)

Summary: Validate ASIN.

Parameters:
     asin  -  The asin.

Returns: true if [is valid asin] [the specified asin]; otherwise, false.

IsValidEan

bool IsValidEan(string code)

Summary: Validate European Article Number.

Parameters:
     code  -  The code.

Returns: true if [is valid ean] [the specified code]; otherwise, false.

IsValidGtin

bool IsValidGtin(string code)

Summary: Validate Global Trade Item Number.

Parameters:
     code  -  The code.

Returns: true if [is valid gtin] [the specified code]; otherwise, false.

IsValidIsbn10

bool IsValidIsbn10(string isbn10)

Summary: Validate ISBN10.

Parameters:
     isbn10  -  The isbn10.

Returns: true if [is valid isbn10] [the specified isbn10]; otherwise, false.

IsValidIsbn13

bool IsValidIsbn13(string isbn13)

Summary: Validate ISBN13.

Parameters:
     isbn13  -  The isbn13.

Returns: true if [is valid isbn13] [the specified isbn13]; otherwise, false.

IsValidIssn

bool IsValidIssn(string code)

Summary: Validate ISSN.

Parameters:
     code  -  The code.

Returns: true if [is valid issn] [the specified code]; otherwise, false.

IsValidUpc

bool IsValidUpc(string code)

Summary: Validate a UPC.

Parameters:
     code  -  The code.

Returns: true if [is valid upc] [the specified code]; otherwise, false.

TryConvertToGtin

bool TryConvertToGtin(string code, out string gtin)

Summary: Attempts to convert a UPC or EAN13 to a GTIN.

Parameters:
     code  -  The code.
     gtin  -  The gtin.


AssemblyHelper

The AssemblyHelper module contains procedures used to preform assembly operations.

public static class AssemblyHelper

Static Methods

GetAssemblyInformations

AssemblyInformation[] GetAssemblyInformations()

Summary: Gets the assembly informations.

Returns: The array of Atc.Data.Models.AssemblyInformation.

GetAssemblyInformationsByStartsWith

AssemblyInformation[] GetAssemblyInformationsByStartsWith(string value)

Summary: Gets the assembly informations by assembly fullname should start with value.

Parameters:
     value  -  The value.

Returns: The array of Atc.Data.Models.AssemblyInformation.

GetAssemblyInformationsBySystem

AssemblyInformation[] GetAssemblyInformationsBySystem()

Summary: Gets the assembly informations by system.

Returns: The array of Atc.Data.Models.AssemblyInformation.

GetProjectRootDirectory

DirectoryInfo GetProjectRootDirectory()

Summary: Retrieves the project root directory by searching upwards from the current assembly's base directory. The method looks for a directory containing a .csproj or .sln file, which is commonly found in the root of a C# project.

Returns: A System.IO.DirectoryInfo object representing the project root directory, or the assembly's base directory if the project root cannot be determined.

Remarks: This method starts at the current assembly's base directory and moves up the directory tree until it finds a directory containing at least one .csproj or .sln file. This directory is considered the project root. If no such directory is found, the method defaults to returning the base directory of the application domain. This approach allows the method to be more adaptable to various project structures without relying on a fixed directory depth. However, it assumes that the project root will contain at least one .csproj or .sln file.

GetSystemLocation

string GetSystemLocation()

Summary: Gets the system location.

Returns: System location.

GetSystemLocationPath

string GetSystemLocationPath()

Summary: Gets the system location path.

Returns: System location path.

GetSystemName

string GetSystemName()

Summary: Gets the system name.

Returns: System name.

GetSystemNameAsKebabCasing

string GetSystemNameAsKebabCasing()

Summary: Gets the system name as kebab casing.

Returns: System name as kebab casing.

GetSystemVersion

Version GetSystemVersion()

Summary: Gets the system version.

Returns: System version.

Load

Assembly Load(FileInfo assemblyFile)

Summary: Load the specified assembly file, with a reference to memory and not the specified file.

Parameters:
     assemblyFile  -  The assembly file.

Returns: The Assembly that is loaded.

Remarks: The assembly is never directly loaded, to avoid holding a instance as "assembly = Assembly.Load(file)" do.

ReadAsBytes

byte[] ReadAsBytes(FileInfo assemblyFile)

Summary: Read the specified assembly file into a byte array.

Parameters:
     assemblyFile  -  The assembly file.

Returns: The Assembly in a byte array.


ByteHelper

ByteHelper.

public static class ByteHelper

Static Methods

ConvertToFourBytes

byte[] ConvertToFourBytes(int value)

Summary: Convert the System.Int32 value to four bytes.

Parameters:
     value  -  The value.

ConvertToTwoBytes

byte[] ConvertToTwoBytes(int value)

Summary: Convert the System.Int32 value to two bytes.

Parameters:
     value  -  The value.

CreateZeroArray

byte[] CreateZeroArray(int size)

Summary: Create a array with the given size that only contains zeros.

Parameters:
     size  -  The size.

HasBit

bool HasBit(byte value, byte checkValue)

Summary: Determines whether the specified value has the bit set compared with the check-value.

Parameters:
     value  -  The value.
     checkValue  -  The check value.

HasBit

bool HasBit(byte value, int checkValue)

Summary: Determines whether the specified value has the bit set compared with the check-value.

Parameters:
     value  -  The value.
     checkValue  -  The check value.


CardinalDirectionTypeHelper

Enumeration Helper: CardinalDirectionTypeHelper.

public static class CardinalDirectionTypeHelper

Static Methods

GetByRotationNumberClockwiseUsingMedium

CardinalDirectionType GetByRotationNumberClockwiseUsingMedium(int rotationNumber)

Summary: Gets the by rotation number clockwise using medium.

Parameters:
     rotationNumber  -  The rotation number.

Remarks: 0 => North 1 => NorthEast 2 => East 3 => SouthEast 4 => South 5 => SouthWest 6 => West 7 => NorthWest.

GetTargetCardinalDirectionByGridCells

CardinalDirectionType GetTargetCardinalDirectionByGridCells(GridCell sourceGridCell, GridCell targetGridCell)

Summary: Gets the target cardinal direction by grid cells.

Parameters:
     sourceGridCell  -  The source grid cell.
     targetGridCell  -  The target grid cell.

GetTargetCardinalDirectionByPoint2Ds

CardinalDirectionType GetTargetCardinalDirectionByPoint2Ds(Point2D sourceGridCell, Point2D targetGridCell)

Summary: Gets the target cardinal direction by point2 ds.

Parameters:
     sourceGridCell  -  The source grid cell.
     targetGridCell  -  The target grid cell.

GetTheClosestByAngle

CardinalDirectionType GetTheClosestByAngle(CardinalDirectionType combinedCardinalDirectionType, double angle)

Summary: Gets the closest by angle.

Parameters:
     combinedCardinalDirectionType  -  Type of the combined cardinal direction.
     angle  -  The angle.

GetWhenRotate180

CardinalDirectionType GetWhenRotate180(CardinalDirectionType cardinalDirectionTypeToInclude, CardinalDirectionType cardinalDirectionType)

Summary: Gets the when rotate180.

Parameters:
     cardinalDirectionTypeToInclude  -  The cardinal direction type to include.
     cardinalDirectionType  -  Type of the cardinal direction.

GetWhenRotateLeft

CardinalDirectionType GetWhenRotateLeft(CardinalDirectionType cardinalDirectionTypeToInclude, CardinalDirectionType cardinalDirectionType, int rotationNumber)

Summary: Gets the when rotate left.

Parameters:
     cardinalDirectionTypeToInclude  -  The cardinal direction type to include.
     cardinalDirectionType  -  Type of the cardinal direction.
     rotationNumber  -  The rotation number.

GetWhenRotateLeft

CardinalDirectionType GetWhenRotateLeft(CardinalDirectionType cardinalDirectionTypeToInclude, CardinalDirectionType cardinalDirectionType)

Summary: Gets the when rotate left.

Parameters:
     cardinalDirectionTypeToInclude  -  The cardinal direction type to include.
     cardinalDirectionType  -  Type of the cardinal direction.
     rotationNumber  -  The rotation number.

GetWhenRotateRight

CardinalDirectionType GetWhenRotateRight(CardinalDirectionType cardinalDirectionTypeToInclude, CardinalDirectionType cardinalDirectionType, int rotationNumber)

Summary: Gets the when rotate right.

Parameters:
     cardinalDirectionTypeToInclude  -  The cardinal direction type to include.
     cardinalDirectionType  -  Type of the cardinal direction.
     rotationNumber  -  The rotation number.

GetWhenRotateRight

CardinalDirectionType GetWhenRotateRight(CardinalDirectionType cardinalDirectionTypeToInclude, CardinalDirectionType cardinalDirectionType)

Summary: Gets the when rotate right.

Parameters:
     cardinalDirectionTypeToInclude  -  The cardinal direction type to include.
     cardinalDirectionType  -  Type of the cardinal direction.
     rotationNumber  -  The rotation number.


CliHelper

CliHelper.

public static class CliHelper

Static Methods

GetCurrentVersion

Version GetCurrentVersion()

Summary: Gets the current version from the executing assembly.

Returns: Return the System.Version of the CLI tool.


CultureHelper

CultureHelper.

public static class CultureHelper

Static Methods

GetCountryNames

Dictionary<int, string> GetCountryNames(DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the country names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetCountryNames

Dictionary<int, string> GetCountryNames(int displayLanguageLcid, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the country names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetCountryNames

Dictionary<int, string> GetCountryNames(List<int> includeOnlyLcids, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the country names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetCountryNames

Dictionary<int, string> GetCountryNames(int displayLanguageLcid, List<int> includeOnlyLcids, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the country names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetCountryNames

Dictionary<int, string> GetCountryNames(List<string> includeOnlyCultureNames, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the country names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetCountryNames

Dictionary<int, string> GetCountryNames(int displayLanguageLcid, List<string> includeOnlyCultureNames, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the country names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetCultureByCountryCodeA2

Culture GetCultureByCountryCodeA2(string value)

Summary: Gets the culture by country code a2.

Parameters:
     value  -  The value.

GetCultureByCountryCodeA2

Culture GetCultureByCountryCodeA2(int displayLanguageLcid, string value)

Summary: Gets the culture by country code a2.

Parameters:
     value  -  The value.

GetCultureByLcid

Culture GetCultureByLcid(int lcid)

Summary: Gets the culture by lcid.

Parameters:
     lcid  -  The lcid.

GetCultureByLcid

Culture GetCultureByLcid(int displayLanguageLcid, int lcid)

Summary: Gets the culture by lcid.

Parameters:
     lcid  -  The lcid.

GetCultureFromValue

Culture GetCultureFromValue(string value)

Summary: Gets the culture from value.

Parameters:
     value  -  The value.

GetCultureFromValue

Culture GetCultureFromValue(int displayLanguageLcid, string value)

Summary: Gets the culture from value.

Parameters:
     value  -  The value.

GetCultureFromValue

Culture GetCultureFromValue(int displayLanguageLcid, List<int> includeLcids, string value)

Summary: Gets the culture from value.

Parameters:
     value  -  The value.

GetCultureLcidsWhereCountryIsNotTranslated

List<int> GetCultureLcidsWhereCountryIsNotTranslated(int displayLanguageLcid, List<int> includeOnlyLcids)

Summary: Gets the culture lcids where country is not translated.

Parameters:
     displayLanguageLcid  -  The display language lcid.
     includeOnlyLcids  -  The include only lcids.

GetCultureLcidsWhereLanguageIsNotTranslated

List<int> GetCultureLcidsWhereLanguageIsNotTranslated(int displayLanguageLcid, List<int> includeOnlyLcids)

Summary: Gets the culture lcids where language is not translated.

Parameters:
     displayLanguageLcid  -  The display language lcid.
     includeOnlyLcids  -  The include only lcids.

GetCultures

List<Culture> GetCultures()

Summary: Gets cultures.

GetCultures

List<Culture> GetCultures(List<int> includeOnlyLcids)

Summary: Gets cultures.

GetCultures

List<Culture> GetCultures(List<string> includeOnlyCultureNames)

Summary: Gets cultures.

GetCultures

List<Culture> GetCultures(int displayLanguageLcid)

Summary: Gets cultures.

GetCultures

List<Culture> GetCultures(int displayLanguageLcid, List<int> includeOnlyLcids)

Summary: Gets cultures.

GetCultures

List<Culture> GetCultures(int displayLanguageLcid, List<string> includeOnlyCultureNames)

Summary: Gets cultures.

GetCulturesByCountryCodeA2

List<Culture> GetCulturesByCountryCodeA2(string value)

Summary: Gets the cultures by country code a2.

Parameters:
     value  -  The value.

GetCulturesByCountryCodeA2

List<Culture> GetCulturesByCountryCodeA2(int displayLanguageLcid, string value)

Summary: Gets the cultures by country code a2.

Parameters:
     value  -  The value.

GetCulturesByLanguageCodeA2

List<Culture> GetCulturesByLanguageCodeA2(string value)

Summary: Gets the cultures by language code a2.

Parameters:
     value  -  The value.

GetCulturesByLanguageCodeA2

List<Culture> GetCulturesByLanguageCodeA2(int displayLanguageLcid, string value)

Summary: Gets the cultures by language code a2.

Parameters:
     value  -  The value.

GetCulturesForCountries

List<Culture> GetCulturesForCountries()

Summary: Gets the cultures for countries.

GetCulturesForLanguages

List<Culture> GetCulturesForLanguages()

Summary: Gets the cultures for languages.

GetLanguageNames

Dictionary<int, string> GetLanguageNames(DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the language names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetLanguageNames

Dictionary<int, string> GetLanguageNames(int displayLanguageLcid, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the language names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetLanguageNames

Dictionary<int, string> GetLanguageNames(List<int> includeOnlyLcids, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the language names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetLanguageNames

Dictionary<int, string> GetLanguageNames(int displayLanguageLcid, List<int> includeOnlyLcids, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the language names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetLanguageNames

Dictionary<int, string> GetLanguageNames(List<string> includeOnlyCultureNames, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the language names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetLanguageNames

Dictionary<int, string> GetLanguageNames(int displayLanguageLcid, List<string> includeOnlyCultureNames, DropDownFirstItemType dropDownFirstItemType = None)

Summary: Gets the language names.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

GetSupportedCultures

IList<Culture> GetSupportedCultures(int displayLanguageLcid = 1033)

CultureInfoHelper

public static class CultureInfoHelper

Static Methods

GetCulturesFromNames

IList<CultureInfo> GetCulturesFromNames(IEnumerable<string> cultureNames)

DataAnnotationHelper

public static class DataAnnotationHelper

Static Methods

TryValidate

bool TryValidate(T data, out IList`1 validationResults, bool validateAllProperties = True)

TryValidateOutToString

bool TryValidateOutToString(T data, out string validationMessage, bool validateAllProperties = True)

TryValidateOutToValidationException

bool TryValidateOutToValidationException(T data, out ValidationException validationException, bool validateAllProperties = True)

DateTimeHelper

DateTimeHelper.

public static class DateTimeHelper

Static Methods

TryParseShortDateUsingCurrentUiCulture

bool TryParseShortDateUsingCurrentUiCulture(string value, out DateTime result)

Summary: Tries to parse a string representation of a short date using the current UI culture's date format.

Parameters:
     value  -  The string to parse.
     result  -   When this method returns, contains the parsed DateTime, if the parse operation was successful; otherwise, contains the default DateTime.

Returns: true if the parsing was successful; otherwise, false.

TryParseShortDateUsingSpecificCulture

bool TryParseShortDateUsingSpecificCulture(string value, CultureInfo cultureInfo, out DateTime result)

Summary: Tries to parse a string representation of a short date using a specific culture's date format.

Parameters:
     value  -  The string to parse.
     cultureInfo  -  The culture info to use for parsing.
     result  -   When this method returns, contains the parsed DateTime, if the parse operation was successful; otherwise, contains the default DateTime.

Returns: true if the parsing was successful; otherwise, false.

TryParseShortTimeUsingCurrentUiCulture

bool TryParseShortTimeUsingCurrentUiCulture(string value, out DateTime result)

Summary: Tries to parse a string representation of a short time using the current UI culture's time format (12-hour or 24-hour).

Parameters:
     value  -  The string to parse.
     result  -   When this method returns, contains the parsed DateTime, if the parse operation was successful; otherwise, contains the default DateTime.

Returns: true if the parsing was successful; otherwise, false.

TryParseShortTimeUsingCurrentUiCultureUtc

bool TryParseShortTimeUsingCurrentUiCultureUtc(string value, out DateTime result)

Summary: Tries to parse a string representation of a short UTC time using the current UI culture's time format (12-hour or 24-hour).

Parameters:
     value  -  The string to parse.
     result  -   When this method returns, contains the parsed DateTime, if the parse operation was successful; otherwise, contains the default DateTime.

Returns: true if the parsing was successful; otherwise, false.

TryParseShortTimeUsingSpecificCulture

bool TryParseShortTimeUsingSpecificCulture(string value, CultureInfo cultureInfo, out DateTime result)

Summary: Tries to parse a string representation of a short time using a specific culture's time format (12-hour or 24-hour).

Parameters:
     value  -  The string to parse.
     cultureInfo  -  The culture info to use for parsing.
     result  -   When this method returns, contains the parsed DateTime, if the parse operation was successful; otherwise, contains the default DateTime.

Returns: true if the parsing was successful; otherwise, false.

TryParseShortTimeUsingSpecificCultureUtc

bool TryParseShortTimeUsingSpecificCultureUtc(string value, CultureInfo cultureInfo, out DateTime result)

Summary: Tries to parse a string representation of a short UTC time using a specific culture's time format (12-hour or 24-hour).

Parameters:
     value  -  The string to parse.
     cultureInfo  -  The culture info to use for parsing.
     result  -   When this method returns, contains the parsed DateTime in UTC, if the parse operation was successful; otherwise, contains the default DateTime.

Returns: true if the parsing was successful; otherwise, false.

TryParseUsingCurrentUiCulture

bool TryParseUsingCurrentUiCulture(string value, out DateTime result)

Summary: Tries to parse a string representation of a DateTime using the current UI culture's date and time format.

Parameters:
     value  -  The string to parse.
     result  -   When this method returns, contains the parsed DateTime, if the parse operation was successful; otherwise, contains the default DateTime.

Returns: true if the parsing was successful; otherwise, false.

TryParseUsingSpecificCulture

bool TryParseUsingSpecificCulture(string value, CultureInfo cultureInfo, out DateTime result)

Summary: Tries to parse a string representation of a DateTime using a specific culture's date and time format.

Parameters:
     value  -  The string to parse.
     cultureInfo  -  The culture info to use for parsing.
     result  -   When this method returns, contains the parsed DateTime, if the parse operation was successful; otherwise, contains the default DateTime.

Returns: true if the parsing was successful; otherwise, false.


DateTimeOffsetHelper

DateTimeOffsetHelper.

public static class DateTimeOffsetHelper

Static Methods

TryParseShortDateUsingCurrentUiCulture

bool TryParseShortDateUsingCurrentUiCulture(string value, out DateTime result)

Summary: Tries to parse a string representation of a short date using the current UI culture's date format.

Parameters:
     value  -  The string to parse.
     result  -   When this method returns, contains the parsed DateTimeOffset, if the parse operation was successful; otherwise, contains the default DateTimeOffset.

Returns: true if the parsing was successful; otherwise, false.

TryParseShortTimeUsingCurrentUiCulture

bool TryParseShortTimeUsingCurrentUiCulture(string value, out DateTime result)

Summary: Tries to parse a string representation of a short time using the current UI culture's time format (12-hour or 24-hour).

Parameters:
     value  -  The string to parse.
     result  -   When this method returns, contains the parsed DateTimeOffset, if the parse operation was successful; otherwise, contains the default DateTimeOffset.

Returns: true if the parsing was successful; otherwise, false.

TryParseShortTimeUsingCurrentUiCultureUtc

bool TryParseShortTimeUsingCurrentUiCultureUtc(string value, out DateTime result)

Summary: Tries to parse a string representation of a short UTC time using the current UI culture's time format (12-hour or 24-hour).

Parameters:
     value  -  The string to parse.
     result  -   When this method returns, contains the parsed DateTimeOffset, if the parse operation was successful; otherwise, contains the default DateTimeOffset.

Returns: true if the parsing was successful; otherwise, false.

TryParseUsingCurrentUiCulture

bool TryParseUsingCurrentUiCulture(string value, out DateTime result)

Summary: Tries to parse a string representation of a DateTimeOffset using the current UI culture's date and time format.

Parameters:
     value  -  The string to parse.
     result  -   When this method returns, contains the parsed DateTimeOffset, if the parse operation was successful; otherwise, contains the default DateTimeOffset.

Returns: true if the parsing was successful; otherwise, false.


DayOfWeekHelper

DayOfWeekHelper.

public static class DayOfWeekHelper

Static Methods

GetDescription

string GetDescription(DayOfWeek dayOfWeek, CultureInfo culture = null)

Summary: Gets the description.

Parameters:
     dayOfWeek  -  The day of week.
     culture  -  The culture.

GetDescriptions

Dictionary<DayOfWeek, string> GetDescriptions(CultureInfo culture = null)

Summary: Gets the descriptions.

Parameters:
     culture  -  The culture.

TryParseDescription

bool TryParseDescription(string value, out DayOfWeek dayOfWeek, CultureInfo culture = null)

Summary: Tries the parse description.

Parameters:
     value  -  The value.
     dayOfWeek  -  The day of week.
     culture  -  The culture.


DirectoryInfoHelper

public static class DirectoryInfoHelper

Static Methods

GetTempPath

DirectoryInfo GetTempPath()

GetTempPathWithSubFolder

DirectoryInfo GetTempPathWithSubFolder(string folderName)

DropDownFirstItemTypeHelper

Enumeration Helper: DropDownFirstItemTypeHelper.

public static class DropDownFirstItemTypeHelper

Static Methods

EnsureFirstItemType

List<string> EnsureFirstItemType(List<string> list, DropDownFirstItemType dropDownFirstItemType)

Summary: Ensures the first type of the item.

Parameters:
     list  -  The list.
     dropDownFirstItemType  -  Type of the drop down first item.

GetEnumGuid

Guid GetEnumGuid(DropDownFirstItemType dropDownFirstItemType)

Summary: Gets the enumeration GUID.

Parameters:
     dropDownFirstItemType  -  Type of the drop down first item.

Returns: The System.Guid.

GetItemFromEnumGuid

DropDownFirstItemType GetItemFromEnumGuid(Guid key)

Summary: Gets the item from enumeration GUID.

Parameters:
     key  -   The key.

Returns: The Atc.DropDownFirstItemType.


EnumHelper

Enumeration Helper: EnumHelper.

public static class EnumHelper

Static Methods

ConvertEnumToArray

Array ConvertEnumToArray(Type enumType, DropDownFirstItemType dropDownFirstItemType = None, bool useDescriptionAttribute = False, bool includeDefault = True, SortDirectionType sortDirectionType = None, bool byFlagIncludeBase = True, bool byFlagIncludeCombined = True)

Summary: Converts the enum to array.

Parameters:
     enumType  -  Type of the enum.
     dropDownFirstItemType  -  Type of the drop down first item.
     useDescriptionAttribute  -  if set to true [use description attribute].
     includeDefault  -  if set to true [include default].
     sortDirectionType  -  Type of the sort direction.
     byFlagIncludeBase  -  if set to true [by flag include base].
     byFlagIncludeCombined  -  if set to true [by flag include combined].

ConvertEnumToDictionary

Dictionary<int, string> ConvertEnumToDictionary(Type enumType, DropDownFirstItemType dropDownFirstItemType = None, bool useDescriptionAttribute = False, bool includeDefault = True, SortDirectionType sortDirectionType = None, bool byFlagIncludeBase = True, bool byFlagIncludeCombined = True)

Summary: Converts the enum to dictionary.

Parameters:
     enumType  -  Type of the enum.
     dropDownFirstItemType  -  Type of the drop down first item.
     useDescriptionAttribute  -  if set to true [use description attribute].
     includeDefault  -  if set to true [include default].
     sortDirectionType  -  Type of the sort direction.
     byFlagIncludeBase  -  if set to true [by flag include base].
     byFlagIncludeCombined  -  if set to true [by flag include combined].

ConvertEnumToDictionaryWithStringKey

Dictionary<string, string> ConvertEnumToDictionaryWithStringKey(Type enumType, DropDownFirstItemType dropDownFirstItemType = None, bool useDescriptionAttribute = False, bool includeDefault = True, SortDirectionType sortDirectionType = None, bool byFlagIncludeBase = True, bool byFlagIncludeCombined = True)

Summary: Converts the enum to dictionary with string key.

Parameters:
     enumType  -  Type of the enum.
     dropDownFirstItemType  -  Type of the drop down first item.
     useDescriptionAttribute  -  if set to true [use description attribute].
     includeDefault  -  if set to true [include default].
     sortDirectionType  -  Type of the sort direction.
     byFlagIncludeBase  -  if set to true [by flag include base].
     byFlagIncludeCombined  -  if set to true [by flag include combined].

GetDescription

string GetDescription(Enum enumeration)

Summary: Gets the description.

Parameters:
     enumeration  -  The enumeration.

GetEnumValue

T GetEnumValue(string value, bool ignoreCase = True)

Summary: Gets the enum value.

Parameters:
     value  -  The value.
     ignoreCase  -  if set to true [ignore case].

Returns: If parsed successfully and defined as a valid enum value, the enum value is returned. Otherwise the default value is returned.

GetIndividualValues

IList<T> GetIndividualValues(bool includeDefault = True)

Summary: Retrieves individual flag values from a enum.

Parameters:
     includeDefault  -  Includes the default '0' value if true.

Returns: A list of individual values.

GetIndividualValuesByCombinedValueFromFlagEnum

IList<T> GetIndividualValuesByCombinedValueFromFlagEnum(T combinedValue, bool includeDefault = True)

Summary: Extracts and returns individual flags from a combined flag value.

Parameters:
     combinedValue  -  The aggregate value of flags.
     includeDefault  -  Includes the default '0' value if true.

Returns: A list of matching individual flags.

GetIndividualValuesFromEnum

IList<T> GetIndividualValuesFromEnum(bool includeDefault = True)

Summary: Retrieves values from a regular (non-flag) enum.

Parameters:
     includeDefault  -  Includes the default '0' value if true.

Returns: A list of enum values.

GetIndividualValuesFromFlagEnum

IList<T> GetIndividualValuesFromFlagEnum(bool includeDefault = True)

Summary: Retrieves individual flag values from a flag-based enum.

Parameters:
     includeDefault  -  Includes the default '0' value if true.

Returns: A list of individual flag values.

GetName

string GetName(Enum enumeration)

Summary: Gets the name.

Parameters:
     enumeration  -  The enumeration.

GetValueFromDescription

T GetValueFromDescription(string description)

Summary: Gets the value from the description.

Parameters:
     description  -  The description.

Returns: The associated enumeration value.


FileHelper

FileHelper.

public static class FileHelper

Static Fields

LineBreaks

string[] LineBreaks

Summary: The line breaks.

Static Methods

GetFiles

FileInfo[] GetFiles(string path, string searchPattern = *.*, SearchOption searchOption = AllDirectories)

Summary: Gets the files as GetFiles, but skip files and folders with unauthorized access.

Parameters:
     path  -  The directory.
     searchPattern  -  The search pattern.
     searchOption  -  The search option.

GetFiles

FileInfo[] GetFiles(DirectoryInfo path, string searchPattern = *.*, SearchOption searchOption = AllDirectories)

Summary: Gets the files as GetFiles, but skip files and folders with unauthorized access.

Parameters:
     path  -  The directory.
     searchPattern  -  The search pattern.
     searchOption  -  The search option.

ReadAllText

string ReadAllText(FileInfo fileInfo)

Summary: Reads all text in the file with UTF8 encoding.

Parameters:
     fileInfo  -  The file information.

Returns: Return the content from the file, if the file don't exist a empty string will be returned.

ReadAllTextAsync

Task<string> ReadAllTextAsync(FileInfo fileInfo, CancellationToken cancellationToken = null)

Summary: Reads all text in the file with UTF8 encoding.

Parameters:
     fileInfo  -  The file information.
     cancellationToken  -  The cancellation token.

Returns: Return the content from the file, if the file don't exist a empty string will be returned.

ReadAllTextToLines

string[] ReadAllTextToLines(FileInfo fileInfo)

Summary: Reads all text in the file with UTF8 encoding and split it to lines.

Parameters:
     fileInfo  -  The file information.

Returns: Return the content as lines from the file, if the file don't exist a empty string array will be returned.

ReadAllTextToLinesAsync

Task<string[]> ReadAllTextToLinesAsync(FileInfo fileInfo, CancellationToken cancellationToken = null)

Summary: Reads all text in the file with UTF8 encoding and split it to lines.

Parameters:
     fileInfo  -  The file information.
     cancellationToken  -  The cancellation token.

Returns: Return the content as lines from the file, if the file don't exist a empty string array will be returned.

ReadToByteArray

byte[] ReadToByteArray(FileInfo fileInfo)

Summary: Reads to byte array.

Parameters:
     fileInfo  -  The file information.

Returns: Return a byte array from the file

ReadToByteArrayAsync

Task<byte[]> ReadToByteArrayAsync(FileInfo fileInfo, CancellationToken cancellationToken = null)

Summary: Reads to byte array.

Parameters:
     fileInfo  -  The file information.
     cancellationToken  -  The cancellation token.

Returns: Return a byte array from the file

ReadToMemoryStream

MemoryStream ReadToMemoryStream(FileInfo fileInfo)

Summary: Reads to System.IO.MemoryStream.

Parameters:
     fileInfo  -  The file information.

Returns: Return a System.IO.MemoryStream from the file

ReadToMemoryStreamAsync

Task<MemoryStream> ReadToMemoryStreamAsync(FileInfo fileInfo, CancellationToken cancellationToken = null)

Summary: Reads to System.IO.MemoryStream.

Parameters:
     fileInfo  -  The file information.
     cancellationToken  -  The cancellation token.

Returns: Return a System.IO.MemoryStream from the file

WriteAllText

void WriteAllText(FileInfo fileInfo, string content)

Summary: Writes all text to the file with UTF8 encoding.

Parameters:
     fileInfo  -  The file information.
     content  -  The content.

WriteAllTextAsync

Task WriteAllTextAsync(FileInfo fileInfo, string content, CancellationToken cancellationToken = null)

Summary: Writes all text to the file with UTF8 encoding.

Parameters:
     fileInfo  -  The file information.
     content  -  The content.
     cancellationToken  -  The cancellation token.


FileHelper<T>

FileHelper.

public static class FileHelper&lt;T&gt;

Static Methods

ReadJsonFileAndDeserializeAsync

Task<T> ReadJsonFileAndDeserializeAsync(FileInfo fileInfo)

Summary: Read the json file and deserialize to the specified type.

Parameters:
     fileInfo  -  The file.

Returns: The model.

ReadJsonFileToModel

T ReadJsonFileToModel(FileInfo fileInfo)

Summary: Read the json file and deserialize to the specified type.

Parameters:
     fileInfo  -  The file.

Returns: The model.

WriteModelToJsonFile

void WriteModelToJsonFile(FileInfo fileInfo, T model)

Summary: Write the model to a json file.

Parameters:
     fileInfo  -  The file information.
     model  -  The model.

WriteModelToJsonFileAsync

Task WriteModelToJsonFileAsync(FileInfo fileInfo, T model)

Summary: Write the model to a json file.

Parameters:
     fileInfo  -  The file information.
     model  -  The model.


InternetBrowserHelper

public static class InternetBrowserHelper

Static Methods

CloseMainWindowOnAllRunningInternetBrowsers

void CloseMainWindowOnAllRunningInternetBrowsers()

CloseMainWindowOnRunningBraveInstances

void CloseMainWindowOnRunningBraveInstances()

CloseMainWindowOnRunningFirefoxInstances

void CloseMainWindowOnRunningFirefoxInstances()

CloseMainWindowOnRunningGhostBrowserInstances

void CloseMainWindowOnRunningGhostBrowserInstances()

CloseMainWindowOnRunningGoogleChromeInstances

void CloseMainWindowOnRunningGoogleChromeInstances()

CloseMainWindowOnRunningMicrosoftEdgeInstances

void CloseMainWindowOnRunningMicrosoftEdgeInstances()

CloseMainWindowOnRunningMicrosoftInternetExplorerInstances

void CloseMainWindowOnRunningMicrosoftInternetExplorerInstances()

CloseMainWindowOnRunningOperaInstances

void CloseMainWindowOnRunningOperaInstances()

CloseMainWindowOnRunningSafariInstances

void CloseMainWindowOnRunningSafariInstances()

GetRunningInternetBrowsers

IList<string> GetRunningInternetBrowsers()

IsBraveRunning

bool IsBraveRunning()

IsFirefoxRunning

bool IsFirefoxRunning()

IsGhostBrowserRunning

bool IsGhostBrowserRunning()

IsGoogleChromeRunning

bool IsGoogleChromeRunning()

IsMicrosoftEdgeRunning

bool IsMicrosoftEdgeRunning()

IsMicrosoftInternetExplorerRunning

bool IsMicrosoftInternetExplorerRunning()

IsOperaRunning

bool IsOperaRunning()

IsSafariRunning

bool IsSafariRunning()

KillAllRunningInternetBrowsers

void KillAllRunningInternetBrowsers()

KillRunningBraveInstances

void KillRunningBraveInstances()

KillRunningFirefoxInstances

void KillRunningFirefoxInstances()

KillRunningGhostBrowserInstances

void KillRunningGhostBrowserInstances()

KillRunningGoogleChromeInstances

void KillRunningGoogleChromeInstances()

KillRunningMicrosoftEdgeInstances

void KillRunningMicrosoftEdgeInstances()

KillRunningMicrosoftInternetExplorerInstances

void KillRunningMicrosoftInternetExplorerInstances()

KillRunningOperaInstances

void KillRunningOperaInstances()

KillRunningSafariInstances

void KillRunningSafariInstances()

OpenUrl

bool OpenUrl(string url)

Summary: Open the given url in the default browser on the machine.

Parameters:
     url  -  The URL.

Returns: true if the url is started in a browser; otherwise, false.

Remarks: Only url with the http or https protocol is supported.

OpenUrl

bool OpenUrl(Uri uri)

Summary: Open the given url in the default browser on the machine.

Parameters:
     url  -  The URL.

Returns: true if the url is started in a browser; otherwise, false.

Remarks: Only url with the http or https protocol is supported.


MathHelper

The MathHelper module contains procedures used to preform math operations.

public static class MathHelper

Static Methods

Acos

double Acos(double value)

Summary: Returns the angle whose cosine is the specified number.

Parameters:
     value  -  A number representing a cosine, where -1 ≤d≤ 1.

Asin

double Asin(double value)

Summary: Returns the angle whose sine is the specified number.

Parameters:
     value  -  A number representing a sine, where -1 ≤d≤ 1.

Atan

double Atan(double value)

Summary: Returns the angle whose tangent is the specified number.

Parameters:
     value  -  A number representing a tangent.

CelsiusToFahrenheit

double CelsiusToFahrenheit(double celsius)

Summary: Celsius to fahrenheit.

Parameters:
     celsius  -  The celsius.

Cos

double Cos(double degrees)

Summary: Returns the cosine of the specified angle.

Parameters:
     degrees  -  An angle, measured in degrees.

DegreesToRadians

double DegreesToRadians(double degrees)

Summary: This function converts degrees to radians.

Parameters:
     degrees  -  An angle, measured in degrees.

EnsureDegreesAreBetween0And360

double EnsureDegreesAreBetween0And360(double degrees)

Summary: Returns the specified angle in the same angle between 0 and 360.

Parameters:
     degrees  -  An angle, measured in degrees.

EnsureDegreesAreBetween0And360

Point2D EnsureDegreesAreBetween0And360(Point2D degrees)

Summary: Returns the specified angle in the same angle between 0 and 360.

Parameters:
     degrees  -  An angle, measured in degrees.

EnsureDegreesAreBetween0And360

Point3D EnsureDegreesAreBetween0And360(Point3D degrees)

Summary: Returns the specified angle in the same angle between 0 and 360.

Parameters:
     degrees  -  An angle, measured in degrees.

FahrenheitToCelsius

double FahrenheitToCelsius(double fahrenheit)

Summary: Fahrenheit to celsius.

Parameters:
     fahrenheit  -  The fahrenheit.

IsEqualToZero

bool IsEqualToZero(double value)

Summary: Determines whether [is equal to zero] [the specified value].

Parameters:
     value  -  The value.

Returns: true if [is equal to zero] [the specified value]; otherwise, false.

IsEquals

bool IsEquals(double value1, double value2)

Summary: Determines whether the specified value1 is equals.

Parameters:
     value1  -  The value1.
     value2  -  The value2.

Returns: true if the specified value1 is equals; otherwise, false.

Max

int Max(int[] values)

Summary: Maxes the specified values.

Parameters:
     values  -  The values.

Max

int Max(List<int> values)

Summary: Maxes the specified values.

Parameters:
     values  -  The values.

Max

double Max(double[] values)

Summary: Maxes the specified values.

Parameters:
     values  -  The values.

Max

double Max(List<double> values)

Summary: Maxes the specified values.

Parameters:
     values  -  The values.

Min

int Min(int[] values)

Summary: Min the specified values.

Parameters:
     values  -  The values.

Min

int Min(List<int> values)

Summary: Min the specified values.

Parameters:
     values  -  The values.

Min

double Min(double[] values)

Summary: Min the specified values.

Parameters:
     values  -  The values.

Min

double Min(List<double> values)

Summary: Min the specified values.

Parameters:
     values  -  The values.

Percentage

double Percentage(double totalValue, double value, int digits = 2, bool limit0To100 = False)

Summary: Percentages the specified total value.

Parameters:
     totalValue  -  The total value.
     value  -  The value.
     digits  -  The digits.
     limit0To100  -  If set, the calculated percentage will be round up/down to min 0 or max 100.

Returns: The calculated percentage.

Code usage:

double value = MathUtil.Percentage(totalValue, value);

Code example:

double totalValue = 100;
double value = 10;
double procentage = MathUtil.Percentage(totalValue, value);

PercentageAsInteger

int PercentageAsInteger(double totalValue, double value)

Summary: Percentages as integer.

Parameters:
     totalValue  -  The total value.
     value  -  The value.

Returns: The calculated percentage.

Code usage:

int value = MathUtil.PercentageAsInteger(totalValue, value);

Code example:

double totalValue = 100;
double value = 10;
int procentage = MathUtil.PercentageAsInteger(totalValue, value);

RadiansToDegrees

double RadiansToDegrees(double radians)

Summary: This function converts radians to degrees.

Parameters:
     radians  -  An angle, measured in radians.

Sin

double Sin(double degrees)

Summary: Returns the sine of the specified angle.

Parameters:
     degrees  -  An angle, measured in degrees.

Tan

double Tan(double degrees)

Summary: Returns the tangent of the specified angle.

Parameters:
     degrees  -  An angle, measured in degrees.

TruncateToMaxPrecision

double TruncateToMaxPrecision(double value, int decimalPrecision)

Summary: Truncates to maximum precision.

Parameters:
     value  -  The value.
     decimalPrecision  -  The decimal precision.


NetworkInformationHelper

public static class NetworkInformationHelper

Static Methods

GetPublicIpAddress

IPAddress GetPublicIpAddress()

HasConnection

bool HasConnection()

HasConnection

bool HasConnection(IPAddress ipAddress)

HasHttpConnection

bool HasHttpConnection()

HasHttpConnection

bool HasHttpConnection(Uri uri)

HasTcpConnection

bool HasTcpConnection(IPAddress ipAddress, int port)

NumberHelper

public static class NumberHelper

Static Methods

IsDecimal

bool IsDecimal(string value)

IsDecimal

bool IsDecimal(string value, bool useUiCulture)

IsDecimal

bool IsDecimal(string value, CultureInfo cultureInfo)

IsDouble

bool IsDouble(string value)

IsDouble

bool IsDouble(string value, bool useUiCulture)

IsDouble

bool IsDouble(string value, CultureInfo cultureInfo)

IsFloat

bool IsFloat(string value)

IsFloat

bool IsFloat(string value, bool useUiCulture)

IsFloat

bool IsFloat(string value, CultureInfo cultureInfo)

IsInt

bool IsInt(string value)

IsNumber

bool IsNumber(string value)

IsNumber

bool IsNumber(string value, bool useUiCulture)

IsNumber

bool IsNumber(string value, CultureInfo cultureInfo)

ParseToDecimal

decimal ParseToDecimal(string value)

ParseToDecimal

decimal ParseToDecimal(string value, bool useUiCulture)

ParseToDecimal

decimal ParseToDecimal(string value, CultureInfo cultureInfo)

ParseToDouble

double ParseToDouble(string value)

ParseToDouble

double ParseToDouble(string value, bool useUiCulture)

ParseToDouble

double ParseToDouble(string value, CultureInfo cultureInfo)

ParseToFloat

float ParseToFloat(string value)

ParseToFloat

float ParseToFloat(string value, bool useUiCulture)

ParseToFloat

float ParseToFloat(string value, CultureInfo cultureInfo)

ParseToInt

int ParseToInt(string value)

TryParseToDecimal

bool TryParseToDecimal(string value, out decimal result)

TryParseToDecimal

bool TryParseToDecimal(string value, bool useUiCulture, out decimal result)

TryParseToDecimal

bool TryParseToDecimal(string value, CultureInfo cultureInfo, out decimal result)

TryParseToDouble

bool TryParseToDouble(string value, out double result)

TryParseToDouble

bool TryParseToDouble(string value, bool useUiCulture, out double result)

TryParseToDouble

bool TryParseToDouble(string value, CultureInfo cultureInfo, out double result)

TryParseToFloat

bool TryParseToFloat(string value, out float result)

TryParseToFloat

bool TryParseToFloat(string value, bool useUiCulture, out float result)

TryParseToFloat

bool TryParseToFloat(string value, CultureInfo cultureInfo, out float result)

TryParseToInt

bool TryParseToInt(string value, out int result)

ProcessHelper

public static class ProcessHelper

Static Methods

Execute

Task<ValueTuple<bool, string>> Execute(FileInfo fileInfo, string arguments, bool runAsAdministrator = False, ushort timeoutInSec = 30, CancellationToken cancellationToken = null)

Execute

Task<ValueTuple<bool, string>> Execute(DirectoryInfo workingDirectory, FileInfo fileInfo, string arguments, bool runAsAdministrator = False, ushort timeoutInSec = 30, CancellationToken cancellationToken = null)

ExecuteAndIgnoreOutput

Task<bool> ExecuteAndIgnoreOutput(FileInfo fileInfo, string arguments, bool runAsAdministrator = False, ushort timeoutInSec = 30, CancellationToken cancellationToken = null)

ExecuteAndIgnoreOutput

Task<bool> ExecuteAndIgnoreOutput(DirectoryInfo workingDirectory, FileInfo fileInfo, string arguments, bool runAsAdministrator = False, ushort timeoutInSec = 30, CancellationToken cancellationToken = null)

ExecutePrompt

Task<ValueTuple<bool, string>> ExecutePrompt(DirectoryInfo workingDirectory, FileInfo fileInfo, string arguments, string[] inputLines, bool runAsAdministrator = False, ushort timeoutInSec = 1, CancellationToken cancellationToken = null)

KillById

ValueTuple<bool, string> KillById(int processId, int timeoutInSec = 30)

KillByName

ValueTuple<bool, string> KillByName(string processName, bool allowMultiKill = True, int timeoutInSec = 30)

KillEntryCaller

ValueTuple<bool, string> KillEntryCaller(int timeoutInSec = 30)

ReflectionHelper

ReflectionHelper.

public static class ReflectionHelper

Static Methods

SetPrivateField

void SetPrivateField(object target, string fieldName, object value)

Summary: Sets the private field.

Parameters:
     target  -  The target.
     fieldName  -  Name of the field.
     value  -  The value.


RegionInfoHelper

RegionInfoHelper.

public static class RegionInfoHelper

Static Methods

GetAllRegionInfos

List<RegionInfo> GetAllRegionInfos()

Summary: Gets all region infos.

GetAllRegionInfosAsLcids

List<int> GetAllRegionInfosAsLcids()

Summary: Gets all region infos as lcids.

GetCultureInfoByIsoAlpha3

CultureInfo GetCultureInfoByIsoAlpha3(string isoAlpha3Code)

Summary: Gets the culture information by iso alpha3.

Parameters:
     isoAlpha3Code  -  The iso alpha3 code.

GetLcidFromRegionInfo

int GetLcidFromRegionInfo(RegionInfo regionInfo)

Summary: Gets the lcid from region information.

Parameters:
     regionInfo  -  The region information.

GetRegionInfoByIsoAlpha3

RegionInfo GetRegionInfoByIsoAlpha3(string isoAlpha3Code)

Summary: Gets the region information by iso alpha3.

Parameters:
     isoAlpha3Code  -  The iso alpha3 code.

GetRegionInfoByLcid

RegionInfo GetRegionInfoByLcid(int lcid)

Summary: Gets the region information by lcid.

Parameters:
     lcid  -  The lcid.


SimpleTypeHelper

PrimitiveTypeHelper.

public static class SimpleTypeHelper

Static Fields

BeautifySimpleTypeArrayLookup

Dictionary<Type, string> BeautifySimpleTypeArrayLookup

Summary: The beautify simple type array lookup.

BeautifySimpleTypeLookup

Dictionary<Type, string> BeautifySimpleTypeLookup

Summary: The beautify simple type lookup.

PrimitiveTypes

Type[] PrimitiveTypes

Summary: The primitive types.

SimpleTypes

Type[] SimpleTypes

Summary: The simple types.

Static Methods

GetBeautifyArrayTypeName

string GetBeautifyArrayTypeName(Type type)

Summary: Gets the name of the beautify array type.

Parameters:
     type  -  The type.

GetBeautifyTypeName

string GetBeautifyTypeName(Type type)

Summary: Gets the name of the beautify type.

Parameters:
     type  -  The type.

GetBeautifyTypeNameByRef

string GetBeautifyTypeNameByRef(Type type)

Summary: Gets the beautify type name by reference.

Parameters:
     type  -  The type.

IsSimpleType

bool IsSimpleType(string value, StringComparison comparison = Ordinal)

Summary: Determines whether the value is nameof a type that is simple / build-in.

Parameters:
     value  -  The value.
     comparison  -  The string comparison - default is 'Ordinal'.


StackTraceHelper

Provides utility methods for working with stack traces.

public static class StackTraceHelper

Static Methods

ContainsConstructor

bool ContainsConstructor()

Summary: Checks if the current stack trace contains a constructor call.

Returns: True if a constructor call is found; otherwise, false.

ContainsConstructor

bool ContainsConstructor(int drillDownFrameMax)

Summary: Checks if the current stack trace contains a constructor call.

Returns: True if a constructor call is found; otherwise, false.

ContainsPropertyGetterName

bool ContainsPropertyGetterName(string propertyName)

Summary: Checks if the current stack trace contains a property getter call for a specified property name.

Parameters:
     propertyName  -  The name of the property to check.

Returns: True if a getter call is found for the specified property; otherwise, false.

ContainsPropertyGetterName

bool ContainsPropertyGetterName(string propertyName, int drillDownFrameMax)

Summary: Checks if the current stack trace contains a property getter call for a specified property name.

Parameters:
     propertyName  -  The name of the property to check.

Returns: True if a getter call is found for the specified property; otherwise, false.

ContainsPropertyName

bool ContainsPropertyName(string propertyName)

Summary: Checks if the current stack trace contains a property call for a specified property name.

Parameters:
     propertyName  -  The name of the property to check.

Returns: True if a call is found for the specified property; otherwise, false.

ContainsPropertyName

bool ContainsPropertyName(string propertyName, int drillDownFrameMax)

Summary: Checks if the current stack trace contains a property call for a specified property name.

Parameters:
     propertyName  -  The name of the property to check.

Returns: True if a call is found for the specified property; otherwise, false.

ContainsPropertySetterName

bool ContainsPropertySetterName(string propertyName)

Summary: Checks if the current stack trace contains a property setter call for a specified property name.

Parameters:
     propertyName  -  The name of the property to check.

Returns: True if a setter call is found for the specified property; otherwise, false.

ContainsPropertySetterName

bool ContainsPropertySetterName(string propertyName, int drillDownFrameMax)

Summary: Checks if the current stack trace contains a property setter call for a specified property name.

Parameters:
     propertyName  -  The name of the property to check.

Returns: True if a setter call is found for the specified property; otherwise, false.


TaskHelper

TaskHelper.

public static class TaskHelper

Static Methods

Execute

Task<TResult> Execute(Func<CancellationToken, Task<TResult>> taskToRun, TimeSpan timeout, CancellationToken cancellationToken = null)

Summary: Executes the specified task with a timeout.

Parameters:
     taskToRun  -  The task to run.
     timeout  -  The timeout.
     cancellationToken  -  The cancellation token.

FireAndForget

void FireAndForget(Action action)

Summary: Executes the provided action on a background thread, ignoring its completion status. This method is intended for fire-and-forget scenarios where the action is non-critical and does not need to be awaited or monitored.

Parameters:
     action  -  The action to execute asynchronously.

FireAndForget

void FireAndForget(Task task)

Summary: Executes the provided action on a background thread, ignoring its completion status. This method is intended for fire-and-forget scenarios where the action is non-critical and does not need to be awaited or monitored.

Parameters:
     action  -  The action to execute asynchronously.

RunSync

void RunSync(Func<Task> func)

Summary: Runs a Task function synchronous.

Parameters:
     func  -  The Task function.

RunSync

TResult RunSync(Func<Task<TResult>> func)

Summary: Runs a Task function synchronous.

Parameters:
     func  -  The Task function.

WhenAll

Task WhenAll(IEnumerable<Task> tasks)

Summary: This method wraps the built-in Task.WhenAll method, but correctly await`s tasks and gets an AggregateException back.

Parameters:
     tasks  -  The tasks.

Remarks: This method gives us an AggregateException and not only the first exception occurrence, in case of an exception thrown from one of the tasks.

WhenAll

Task<IEnumerable<T>> WhenAll(IEnumerable<Task<T>> tasks)

Summary: This method wraps the built-in Task.WhenAll method, but correctly await`s tasks and gets an AggregateException back.

Parameters:
     tasks  -  The tasks.

Remarks: This method gives us an AggregateException and not only the first exception occurrence, in case of an exception thrown from one of the tasks.

WhenAll

Task<IEnumerable<T>> WhenAll(Task`1[] tasks)

Summary: This method wraps the built-in Task.WhenAll method, but correctly await`s tasks and gets an AggregateException back.

Parameters:
     tasks  -  The tasks.

Remarks: This method gives us an AggregateException and not only the first exception occurrence, in case of an exception thrown from one of the tasks.


ThreadHelper

ThreadHelper.

public static class ThreadHelper

Static Properties

ProcessorCount

ProcessorCount

Summary: Gets the processor count.

Static Methods

GetParallelOptions

ParallelOptions GetParallelOptions(int exemptProcessorCount = 2)

Summary: Gets the parallel options.

Parameters:
     exemptProcessorCount  -  The exempt processor count.


VersionHelper

Provides utility methods for comparing and handling version strings and Version objects.

public static class VersionHelper

Static Methods

IsDefault

bool IsDefault(Version sourceVersion, Version destinationVersion)

Summary: Determines whether both source and destination versions are the default version ("1.0.0.0").

Parameters:
     sourceVersion  -  The source version as a Version object.
     destinationVersion  -  The destination version as a Version object.

Returns: True if both versions are "1.0.0.0"; otherwise, false.

IsSourceNewerThanDestination

bool IsSourceNewerThanDestination(string sourceVersion, string destinationVersion)

Summary: Compares two version strings to determine if the source version is newer than the destination version.

Parameters:
     sourceVersion  -  The source version as a string.
     destinationVersion  -  The destination version as a string.

Returns: True if the source version is newer than the destination version; otherwise, false.

Remarks: If either version string is null, or if they are equal, the method returns false. If the version strings cannot be parsed into System.Version, a lexical comparison is performed.

IsSourceNewerThanDestination

bool IsSourceNewerThanDestination(Version sourceVersion, Version destinationVersion)

Summary: Compares two version strings to determine if the source version is newer than the destination version.

Parameters:
     sourceVersion  -  The source version as a string.
     destinationVersion  -  The destination version as a string.

Returns: True if the source version is newer than the destination version; otherwise, false.

Remarks: If either version string is null, or if they are equal, the method returns false. If the version strings cannot be parsed into System.Version, a lexical comparison is performed.


Generated by MarkdownCodeDoc version 1.2