Table of Contents

Class Exceptions

Namespace
SunamoExceptions
Assembly
SunamoExceptions.dll

Provides static methods for generating exception messages with consistent formatting.

public sealed class Exceptions
Inheritance
Exceptions
Inherited Members
Extension Methods

Methods

AddParams()

Adds additional parameter information to exception messages.

public static string AddParams()

Returns

string

A formatted string containing additional parameter information.

AnyElementIsNullOrEmpty(string, string, IEnumerable<int>)

Creates an error message when collection elements are null or empty.

public static string? AnyElementIsNullOrEmpty(string before, string nameOfCollection, IEnumerable<int> nulled)

Parameters

before string

The prefix for the error message.

nameOfCollection string

The name of the collection.

nulled IEnumerable<int>

Indexes of null/empty elements.

Returns

string

An error message.

ArgumentOutOfRangeException(string, string, string)

Creates an ArgumentOutOfRangeException error message.

public static string? ArgumentOutOfRangeException(string before, string paramName, string message)

Parameters

before string

The prefix for the error message.

paramName string

The name of the parameter.

message string

Additional information.

Returns

string

An error message.

ArrayElementContainsUnallowedStrings(string, string, int, string, params string[])

Checks if an array element contains unallowed strings.

public static string? ArrayElementContainsUnallowedStrings(string before, string arrayName, int dex, string valueElement, params string[] unallowedStrings)

Parameters

before string

The prefix for the error message.

arrayName string

The array name.

dex int

The index of the element.

valueElement string

The element value.

unallowedStrings string[]

The unallowed strings to check for.

Returns

string

An error message if unallowed strings are found, otherwise null.

BadFormatOfElementInList(string, object, string, Func<object, string>)

Creates an error message for a badly formatted element in a list.

public static string? BadFormatOfElementInList(string before, object elVal, string listName, Func<object, string> SH_NullToStringOrDefault)

Parameters

before string

The prefix for the error message.

elVal object

The element value.

listName string

The name of the list.

SH_NullToStringOrDefault Func<object, string>

Function to convert null to string.

Returns

string

An error message.

BadMappedXaml(string, string, string)

Creates an error message for badly mapped XAML.

public static string? BadMappedXaml(string before, string nameControl, string additionalInfo)

Parameters

before string

The prefix for the error message.

nameControl string

The name of the control.

additionalInfo string

Additional information about the error.

Returns

string

An error message.

CannotCreateDateTime(string, int, int, int, int, int, int, Exception)

Creates an error message when DateTime cannot be created with the specified parameters.

public static string? CannotCreateDateTime(string before, int year, int month, int day, int hour, int minute, int seconds, Exception ex)

Parameters

before string

The prefix for the error message.

year int

The year value.

month int

The month value.

day int

The day value.

hour int

The hour value.

minute int

The minute value.

seconds int

The seconds value.

ex Exception

The exception that occurred.

Returns

string

An error message.

CannotMoveFolder(string, string, string, Exception)

Creates an error message when a folder cannot be moved.

public static string? CannotMoveFolder(string before, string sourcePath, string destinationPath, Exception ex)

Parameters

before string

The prefix for the error message.

sourcePath string

The source folder path.

destinationPath string

The destination folder path.

ex Exception

The exception that occurred.

Returns

string

An error message.

CheckBackSlashEnd(string, string)

Checks if a string ends with a backslash.

public static string? CheckBackSlashEnd(string before, string r)

Parameters

before string

The prefix for the error message.

r string

The string to check.

Returns

string

An error message if the string doesn't end with a backslash, otherwise null.

CheckBackslashEnd(string, string)

Checks if a string ends with a backslash.

public static string? CheckBackslashEnd(string before, string path)

Parameters

before string

The prefix for the error message.

path string

The string to check.

Returns

string

An error message if the string doesn't end with a backslash, otherwise null.

CheckBefore(string)

Checks and formats the 'before' parameter, adding a colon separator if not empty.

public static string CheckBefore(string before)

Parameters

before string

The prefix text to check and format.

Returns

string

Empty string if before is null or whitespace, otherwise before with ": " appended.

Custom(string, string)

Creates a custom error message.

public static string? Custom(string before, string message)

Parameters

before string

The prefix for the error message.

message string

The custom message.

Returns

string

An error message.

DifferentCountInLists(string, string, int, string, int)

Checks if two collections have different element counts.

public static string? DifferentCountInLists(string before, string namefc, int countfc, string namesc, int countsc)

Parameters

before string

The prefix for the error message.

namefc string

The name of the first collection.

countfc int

The count of the first collection.

namesc string

The name of the second collection.

countsc int

The count of the second collection.

Returns

string

An error message if counts differ, otherwise null.

DirectoryExists(string, string)

Checks if a directory exists.

public static string? DirectoryExists(string before, string fulLPath)

Parameters

before string

The prefix for the error message.

fulLPath string

The full directory path.

Returns

string

Null if directory exists, otherwise an error message.

DirectoryWasntFound(string, string)

Checks if a directory exists.

public static string? DirectoryWasntFound(string before, string directory)

Parameters

before string

The prefix for the error message.

directory string

The directory path to check.

Returns

string

An error message if the directory doesn't exist, otherwise null.

DivideByZero(string)

Creates an error message for division by zero.

public static string? DivideByZero(string before)

Parameters

before string

The prefix for the error message.

Returns

string

An error message.

DoesntHaveRequiredType(string, string)

Creates an error message when a variable doesn't have the required type.

public static string? DoesntHaveRequiredType(string before, string variableName)

Parameters

before string

The prefix for the error message.

variableName string

The name of the variable.

Returns

string

An error message.

DuplicatedElements(string, string, List<string>, string)

Checks if a list contains duplicated elements.

public static string? DuplicatedElements(string before, string nameOfVariable, List<string> duplicatedElements, string message = "")

Parameters

before string

The prefix for the error message.

nameOfVariable string

The variable name.

duplicatedElements List<string>

The list of duplicated elements.

message string

Additional message.

Returns

string

An error message if duplicates are found, otherwise null.

ElementCantBeFound(string, string, string)

Creates an error message when an element cannot be found in a collection.

public static string? ElementCantBeFound(string before, string nameCollection, string element)

Parameters

before string

The prefix for the error message.

nameCollection string

The name of the collection.

element string

The element that cannot be found.

Returns

string

An error message.

ElementWasntRemoved(string, string, int, int)

Checks if an element wasn't removed from a collection.

public static string? ElementWasntRemoved(string before, string detailLocation, int countBefore, int countAfter)

Parameters

before string

The prefix for the error message.

detailLocation string

Details about where the removal was attempted.

countBefore int

The count before removal.

countAfter int

The count after removal.

Returns

string

An error message if the element wasn't removed, otherwise null.

ExcAsArg(string, Exception, string)

Creates an error message from an exception with an additional message.

public static string? ExcAsArg(string before, Exception ex, string message)

Parameters

before string

The prefix for the error message.

ex Exception

The exception.

message string

Additional message.

Returns

string

An error message.

FileAlreadyExists(string, string)

Checks if a file already exists.

public static string? FileAlreadyExists(string before, string path)

Parameters

before string

The prefix for the error message.

path string

The file path to check.

Returns

string

An error message if the file exists, otherwise null.

FileExists(string, string)

Creates an error message when a file doesn't exist.

public static string? FileExists(string before, string fulLPath)

Parameters

before string

The prefix for the error message.

fulLPath string

The full path to the file.

Returns

string

An error message.

FileHasExtensionNotParseAbleToImageFormat(string, string)

Creates an error message for files with extensions that cannot be parsed to image format.

public static string? FileHasExtensionNotParseAbleToImageFormat(string before, string fnOri)

Parameters

before string

The prefix for the error message.

fnOri string

The original filename.

Returns

string

An error message.

FileSystemException(string, Exception)

Creates an error message from a file system exception.

public static string? FileSystemException(string value, Exception ex)

Parameters

value string

The prefix value.

ex Exception

The exception.

Returns

string

An error message if exception is not null, otherwise null.

FileWasntFoundInDirectory(string, string)

Creates an error message when a file wasn't found in a directory.

public static string? FileWasntFoundInDirectory(string before, string path)

Parameters

before string

The prefix for the error message.

path string

The path where the file was expected.

Returns

string

An error message.

FirstLetterIsNotUpper(string, string)

Checks if the first letter of a string is not uppercase.

public static string? FirstLetterIsNotUpper(string before, string text)

Parameters

before string

The prefix for the error message.

text string

The string to check.

Returns

string

An error message if the first letter is not uppercase, otherwise null.

FolderCannotBeDeleted(string, string, Exception)

Creates an error message when a folder cannot be deleted.

public static string? FolderCannotBeDeleted(string before, string folder, Exception ex)

Parameters

before string

The prefix for the error message.

folder string

The folder path.

ex Exception

The exception that occurred.

Returns

string

An error message.

FolderCantBeRemoved(string, string)

Creates an error message when a folder can't be removed.

public static string? FolderCantBeRemoved(string before, string folder)

Parameters

before string

The prefix for the error message.

folder string

The folder path.

Returns

string

An error message.

FolderIsNotEmpty(string, string, string)

Creates an error message indicating that a folder is not empty.

public static string? FolderIsNotEmpty(string before, string variableName, string path)

Parameters

before string

The prefix for the error message.

variableName string

The name of the variable.

path string

The path to the folder.

Returns

string

An error message.

FunctionalityDenied(string, string)

Creates an error message when functionality is denied.

public static string? FunctionalityDenied(string before, string functionalityName)

Parameters

before string

The prefix for the error message.

functionalityName string

The name of the denied functionality.

Returns

string

An error message.

HasNotIndex<T>(string, IEnumerable<T>, string, int)

Checks if a list has enough elements to access the specified index.

public static string? HasNotIndex<T>(string before, IEnumerable<T> list, string listName, int maxRequiredIndex)

Parameters

before string

The prefix for the error message.

list IEnumerable<T>

The list to check.

listName string

The name of the list for the error message.

maxRequiredIndex int

The maximum index that must be accessible.

Returns

string

An error message if the list doesn't have enough elements, otherwise null.

Type Parameters

T

The type of elements in the list.

HasNotKeyDictionary<Key, Value>(string, string, IDictionary<Key, Value>, Key)

Checks if a dictionary does not contain a specified key.

public static string? HasNotKeyDictionary<Key, Value>(string before, string nameDict, IDictionary<Key, Value> qsDict, Key remains)

Parameters

before string

The prefix for the error message.

nameDict string

The name of the dictionary.

qsDict IDictionary<Key, Value>

The dictionary to check.

remains Key

The key to check for.

Returns

string

An error message if the key is not found, otherwise null.

Type Parameters

Key

The type of the dictionary key.

Value

The type of the dictionary value.

HasOddNumberOfElements(string, string, ICollection)

Checks if a list has an odd number of elements.

public static string? HasOddNumberOfElements(string before, string listName, ICollection list)

Parameters

before string

The prefix for the error message.

listName string

The name of the list.

list ICollection

The list to check.

Returns

string

An error message if the list has an odd number of elements, otherwise null.

HaveAllInnerSameCount(string, List<List<string>>)

Checks if all inner lists have the same count.

public static string? HaveAllInnerSameCount(string before, List<List<string>> elements)

Parameters

before string

The prefix for the error message.

elements List<List<string>>

The list of lists to check.

Returns

string

An error message if counts differ, otherwise null.

InvalidExactlyLength(string, string, int, int)

Validates that a variable has the exact required length.

public static string? InvalidExactlyLength(string before, string variableName, int length, int requiredLenght)

Parameters

before string

The prefix for the error message.

variableName string

The name of the variable.

length int

The actual length.

requiredLenght int

The required length.

Returns

string

An error message if lengths don't match, otherwise null.

InvalidParameter(string, string, string)

Checks if a parameter is URL encoded when it shouldn't be.

public static string? InvalidParameter(string before, string valueVar, string nameVar)

Parameters

before string

The prefix for the error message.

valueVar string

The variable value.

nameVar string

The variable name.

Returns

string

An error message if the parameter is URL encoded, otherwise null.

IsEmpty(string, IEnumerable, string, string)

Checks if a collection is empty.

public static string? IsEmpty(string before, IEnumerable folders, string colName, string additionalMessage = "")

Parameters

before string

The prefix for the error message.

folders IEnumerable

The collection to check.

colName string

The name of the collection.

additionalMessage string

Additional message to append.

Returns

string

An error message if the collection is empty, otherwise null.

IsNotAllowed(string, string)

Creates an error message indicating that something is not allowed.

public static string? IsNotAllowed(string before, string what)

Parameters

before string

The prefix for the error message.

what string

What is not allowed.

Returns

string

An error message.

IsNotNull(string, string, object)

Checks if a variable is not null when it should be.

public static string? IsNotNull(string before, string variableName, object variable)

Parameters

before string

The prefix for the error message.

variableName string

The variable name.

variable object

The variable to check.

Returns

string

An error message if the variable is not null, otherwise null.

IsNotPositiveNumber(string, string, int?)

Checks if a value is not a positive number.

public static string? IsNotPositiveNumber(string before, string nameOfVariable, int? n)

Parameters

before string

The prefix for the error message.

nameOfVariable string

The variable name.

n int?

The value to check.

Returns

string

An error message if the value is not a positive number, otherwise null.

IsNotTheSame<T>(string, string, T, string, T)

Checks if two values are not equal and returns an error message if they differ.

public static string? IsNotTheSame<T>(string before, string name1, T value1, string name2, T value2)

Parameters

before string

The prefix for the error message.

name1 string

The name of the first value.

value1 T

The first value to compare.

name2 string

The name of the second value.

value2 T

The second value to compare.

Returns

string

An error message if values differ, otherwise null.

Type Parameters

T

The type of values to compare.

IsNotWindowsPathFormat(string, string, string, bool, Func<string, bool>)

Checks if a string is not in Windows path format.

public static string? IsNotWindowsPathFormat(string before, string argName, string argValue, bool raiseIsNotWindowsPathFormat, Func<string, bool> SunamoFileSystem_IsWindowsPathFormat)

Parameters

before string

The prefix for the error message.

argName string

The argument name.

argValue string

The argument value to check.

raiseIsNotWindowsPathFormat bool

Whether to raise the check.

SunamoFileSystem_IsWindowsPathFormat Func<string, bool>

Function to check Windows path format.

Returns

string

An error message if the format is invalid, otherwise null.

IsNull(string, string, object?)

Checks if a variable is null.

public static string? IsNull(string before, string variableName, object? variable)

Parameters

before string

The prefix for the error message.

variableName string

The variable name.

variable object

The variable to check.

Returns

string

An error message if the variable is null, otherwise null.

IsNullOrWhitespace(string, string, string, bool)

Checks if a string argument is null, empty, or whitespace.

public static string? IsNullOrWhitespace(string before, string argName, string argValue, bool notAllowOnlyWhitespace)

Parameters

before string

The prefix for the error message.

argName string

The name of the argument.

argValue string

The value to check.

notAllowOnlyWhitespace bool

If true, whitespace-only strings are also considered invalid.

Returns

string

An error message if validation fails, otherwise null.

IsTheSame(string, string, string)

Creates an error message when two values are the same but should differ.

public static string? IsTheSame(string before, string fst, string sec)

Parameters

before string

The prefix for the error message.

fst string

The first value name.

sec string

The second value name.

Returns

string

An error message.

IsWhitespaceOrNull(string, string, object)

Checks if a value is whitespace or null.

public static string? IsWhitespaceOrNull(string before, string variable, object data)

Parameters

before string

The prefix for the error message.

variable string

The variable name.

data object

The data to check.

Returns

string

An error message if the value is whitespace or null, otherwise null.

IsWindowsPathFormat(string, string, Func<string, bool>)

Checks if a string is in Windows path format when it shouldn't be.

public static string? IsWindowsPathFormat(string before, string input, Func<string, bool> isWindowsPathFormat)

Parameters

before string

The prefix for the error message.

input string

The input string to check.

isWindowsPathFormat Func<string, bool>

Function to check Windows path format.

Returns

string

An error message if the input is a path when only a key is expected, otherwise null.

KeyAlreadyExists<T, U>(string, Dictionary<T, U>, T, string)

Checks if a key already exists in a dictionary.

public static string? KeyAlreadyExists<T, U>(string before, Dictionary<T, U> dictionary, T key, string dictionaryName) where T : notnull

Parameters

before string

The prefix for the error message.

dictionary Dictionary<T, U>

The dictionary to check.

key T

The key to check for.

dictionaryName string

The name of the dictionary.

Returns

string

An error message if the key exists, otherwise null.

Type Parameters

T

The type of the dictionary key.

U

The type of the dictionary value.

KeyNotFound<T, U>(string, IDictionary<T, U>, string, T)

Checks if a key is not found in a dictionary.

public static string? KeyNotFound<T, U>(string before, IDictionary<T, U> en, string dictName, T key)

Parameters

before string

The prefix for the error message.

en IDictionary<T, U>

The dictionary to check.

dictName string

The name of the dictionary.

key T

The key to find.

Returns

string

An error message if the key is not found, otherwise null.

Type Parameters

T

The type of the dictionary key.

U

The type of the dictionary value.

ListNullOrEmpty<T>(string, string, IEnumerable<T>?)

Checks if a list is null or empty.

public static string? ListNullOrEmpty<T>(string before, string variableName, IEnumerable<T>? list)

Parameters

before string

The prefix for the error message.

variableName string

The name of the variable.

list IEnumerable<T>

The list to check.

Returns

string

An error message if the list is null or empty, otherwise null.

Type Parameters

T

The type of elements in the list.

LockedByBitLocker(string, string, Func<char, bool>)

Checks if a drive is locked by BitLocker.

public static string? LockedByBitLocker(string before, string path, Func<char, bool> IsLockedByBitLocker)

Parameters

before string

The prefix for the error message.

path string

The path to check.

IsLockedByBitLocker Func<char, bool>

Function to check if a drive is locked.

Returns

string

An error message if the drive is locked, otherwise null.

MoreCandidates(string, IEnumerable<string>, string)

Creates an error message when there are multiple candidates.

public static string? MoreCandidates(string before, IEnumerable<string> list, string item)

Parameters

before string

The prefix for the error message.

list IEnumerable<string>

The list of candidates.

item string

The item with multiple candidates.

Returns

string

An error message.

MoreThanOneElement(string, string, int, string)

Checks if a list has more than one element.

public static string? MoreThanOneElement(string before, string listName, int count, string moreInfo = "")

Parameters

before string

The prefix for the error message.

listName string

The list name.

count int

The actual count.

moreInfo string

Additional information.

Returns

string

An error message if the list has more than one element, otherwise null.

NameIsNotSetted(string, string, string)

Checks if a control's name is not set.

public static string? NameIsNotSetted(string before, string nameControl, string nameFromProperty)

Parameters

before string

The prefix for the error message.

nameControl string

The control name.

nameFromProperty string

The name from the property.

Returns

string

An error message if the name is not set, otherwise null.

NoPassedFolders(string, ICollection)

Checks if no folders were passed.

public static string? NoPassedFolders(string before, ICollection folders)

Parameters

before string

The prefix for the error message.

folders ICollection

The folders collection.

Returns

string

An error message if no folders were passed, otherwise null.

NotContains(string, string, params string[])

Checks if a string does not contain required substrings.

public static string? NotContains(string before, string originalText, params string[] shouldContains)

Parameters

before string

The prefix for the error message.

originalText string

The original text to check.

shouldContains string[]

The substrings that should be contained.

Returns

string

An error message if any required substring is missing, otherwise null.

NotEvenNumberOfElements(string, string)

Creates an error message when a collection has an odd number of elements.

public static string? NotEvenNumberOfElements(string before, string nameOfCollection)

Parameters

before string

The prefix for the error message.

nameOfCollection string

The name of the collection.

Returns

string

An error message.

NotExists(string, string)

Creates an error message when something does not exist.

public static string? NotExists(string before, string what)

Parameters

before string

The prefix for the error message.

what string

What does not exist.

Returns

string

An error message.

NotImplementedCase(string, object)

Creates an error message for a not implemented case.

public static string? NotImplementedCase(string before, object notImplementedName)

Parameters

before string

The prefix for the error message.

notImplementedName object

The name or type of the not implemented case.

Returns

string

An error message.

NotImplementedMethod(string)

Creates an error message for a method that is not implemented.

public static string? NotImplementedMethod(string before)

Parameters

before string

The prefix for the error message.

Returns

string

An error message.

NotInRange(string, string, IEnumerable<string>, int, int)

Checks if a variable is within the specified range.

public static string? NotInRange(string before, string variableName, IEnumerable<string> list, int isLt, int isGt)

Parameters

before string

The prefix for the error message.

variableName string

The name of the variable.

list IEnumerable<string>

The list of items.

isLt int

The lower bound.

isGt int

The upper bound.

Returns

string

An error message if out of range, otherwise null.

NotInt(string, string, int?)

Checks if a value is not a valid integer.

public static string? NotInt(string before, string what, int? value)

Parameters

before string

The prefix for the error message.

what string

Description of what should be an integer.

value int?

The value to check.

Returns

string

An error message if the value is not a valid integer, otherwise null.

NotSupported(string)

Creates a generic "not supported" error message.

public static string? NotSupported(string before)

Parameters

before string

The prefix for the error message.

Returns

string

An error message.

NotSupportedExtension(string, string)

Creates an error message for an unsupported file extension.

public static string? NotSupportedExtension(string before, string extension)

Parameters

before string

The prefix for the error message.

extension string

The unsupported extension.

Returns

string

An error message.

NotValidXml(string, string, Exception)

Creates an error message for invalid XML.

public static string? NotValidXml(string before, string path, Exception ex)

Parameters

before string

The prefix for the error message.

path string

The path to the XML file.

ex Exception

The exception that occurred.

Returns

string

An error message.

OnlyOneElement(string, string, ICollection)

Checks if a collection has only one element.

public static string? OnlyOneElement(string before, string colName, ICollection list)

Parameters

before string

The prefix for the error message.

colName string

The collection name.

list ICollection

The collection.

Returns

string

An error message if the collection has only one element, otherwise null.

OutOfRange(string, string, ICollection, string, int)

Checks if an index is out of range for a collection.

public static string? OutOfRange(string before, string colName, ICollection col, string indexName, int index)

Parameters

before string

The prefix for the error message.

colName string

The collection name.

col ICollection

The collection.

indexName string

The index variable name.

index int

The index value.

Returns

string

An error message if the index is out of range, otherwise null.

PassedListInsteadOfArray<T>(string, string, IEnumerable<T>, Func<IEnumerable<T>, bool>)

Checks if a list was passed instead of an array to a params parameter.

public static string? PassedListInsteadOfArray<T>(string before, string variableName, IEnumerable<T> collection, Func<IEnumerable<T>, bool> CA_IsListStringWrappedInArray)

Parameters

before string

The prefix for the error message.

variableName string

The name of the variable.

collection IEnumerable<T>

The collection to check.

CA_IsListStringWrappedInArray Func<IEnumerable<T>, bool>

Function to check if it's a wrapped list.

Returns

string

An error message if a list was passed instead of an array, otherwise null.

Type Parameters

T

The type of elements.

RepeatAfterTimeXTimesFailed(string, int, int, string, int)

Creates an error message for repeated failed attempts to load a URI.

public static string? RepeatAfterTimeXTimesFailed(string before, int times, int timeoutInMs, string address, int sharedAlgorithmslastError)

Parameters

before string

The prefix for the error message.

times int

Number of failed attempts.

timeoutInMs int

Timeout in milliseconds.

address string

The URI address.

sharedAlgorithmslastError int

The last HTTP error code.

Returns

string

An error message.

StartIsHigherThanEnd(string, int, int)

Checks if start value is higher than end value.

public static string? StartIsHigherThanEnd(string before, int start, int end)

Parameters

before string

The prefix for the error message.

start int

The start value.

end int

The end value.

Returns

string

An error message if start is higher than end, otherwise null.

StringContainsUnallowedSubstrings(string, string, params string[])

Checks if a string contains unallowed substrings.

public static string? StringContainsUnallowedSubstrings(string before, string input, params string[] unallowedStrings)

Parameters

before string

The prefix for the error message.

input string

The input string to check.

unallowedStrings string[]

The unallowed substrings.

Returns

string

An error message if unallowed substrings are found, otherwise null.

TextOfExceptions(Exception)

Gets all messages from an exception and its inner exceptions.

public static string TextOfExceptions(Exception ex)

Parameters

ex Exception

The exception to extract messages from.

Returns

string

A string containing all exception messages.

ToManyElementsInCollection(string, int, int, string)

Creates an error message when a collection has too many elements.

public static string? ToManyElementsInCollection(string before, int max, int actual, string nameCollection)

Parameters

before string

The prefix for the error message.

max int

Maximum allowed elements.

actual int

Actual number of elements.

nameCollection string

The name of the collection.

Returns

string

An error message.

TypeAndMethodName(string, out string, out string)

Extracts type and method name from a stack trace line.

public static void TypeAndMethodName(string stackTraceLine, out string type, out string methodName)

Parameters

stackTraceLine string

The stack trace line to parse.

type string

The extracted type name.

methodName string

The extracted method name.

UncommentNextRows(string)

Creates an error message prompting to uncomment next rows.

public static string? UncommentNextRows(string before)

Parameters

before string

The prefix for the error message.

Returns

string

An error message.

UriFormat(string, string, Func<string, bool>)

Checks if a URL is in valid URI format.

public static string? UriFormat(string before, string url, Func<string, bool> uhIsUri)

Parameters

before string

The prefix for the error message.

url string

The URL to check.

uhIsUri Func<string, bool>

Function to validate URI format.

Returns

string

An error message if the URL format is invalid, otherwise null.

UseRlc(string)

Creates an error message indicating that RLC methods should be used instead.

public static string? UseRlc(string before)

Parameters

before string

The prefix for the error message.

Returns

string

An error message.

WasAlreadyInitialized(string)

Creates an error message indicating that something was already initialized.

public static string WasAlreadyInitialized(string before)

Parameters

before string

The prefix for the error message.

Returns

string

An error message.

WasNotKeysHandler(string, string, object)

Checks if an object is not an IKeysHandler.

public static string? WasNotKeysHandler(string before, string name, object keysHandler)

Parameters

before string

The prefix for the error message.

name string

The name of the object.

keysHandler object

The object to check.

Returns

string

An error message if the object is not an IKeysHandler, otherwise null.

WrongCountInList(string, int, int, int)

Creates an error message for wrong element count in a list.

public static string? WrongCountInList(string before, int numberOfElementsWithoutPause, int numberOfElementsWithPause, int arrLength)

Parameters

before string

The prefix for the error message.

numberOfElementsWithoutPause int

Expected count without pause.

numberOfElementsWithPause int

Expected count with pause.

arrLength int

Actual array length.

Returns

string

An error message.

WrongExtension(string, string, string)

Checks if a file has the wrong extension.

public static string? WrongExtension(string before, string path, string requiredExt)

Parameters

before string

The prefix for the error message.

path string

The file path.

requiredExt string

The required extension.

Returns

string

An error message if the extension is wrong, otherwise null.

WrongNumberOfElements<T>(string, int, string, IEnumerable<T>)

Checks if a collection has the wrong number of elements.

public static string? WrongNumberOfElements<T>(string before, int requireElements, string nameCollection, IEnumerable<T> collection)

Parameters

before string

The prefix for the error message.

requireElements int

The required number of elements.

nameCollection string

The name of the collection.

collection IEnumerable<T>

The collection to check.

Returns

string

An error message if the count is wrong, otherwise null.

Type Parameters

T

The type of elements in the collection.

ZeroOrMoreThanOne(string, string, List<string>)

Checks if a list has zero or more than one element.

public static string? ZeroOrMoreThanOne(string before, string nameOfVariable, List<string> list)

Parameters

before string

The prefix for the error message.

nameOfVariable string

The variable name.

list List<string>

The list to check.

Returns

string

An error message if the list has zero or more than one element, otherwise null.