Table of Contents

Class Globals

Namespace
PolarStudioGlobals
Assembly
PolarStudioGlobals.dll
public static class Globals
Inheritance
Globals
Inherited Members

Fields

BinaryCompare

Compare binary based (case sensitive).

public const int BinaryCompare = 0

Field Value

int

GetPerformanceCounterFrequency

public const long GetPerformanceCounterFrequency = 10000000

Field Value

long

NullDate

The default value for a VB-date.

public static DateTime NullDate

Field Value

DateTime

TextCompare

Compare text based (not case sensitive).

public const int TextCompare = 1

Field Value

int

mcHexCharacters

Characters allowed in hex strings.

public const string mcHexCharacters = "0123456789abcdefABCDEF"

Field Value

string

mcKeywordContinueCharacters

Characters allowed in keywords.

public const string mcKeywordContinueCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"

Field Value

string

mcKeywordStartCharacters

Characters that a keyword can start with.

public const string mcKeywordStartCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"

Field Value

string

mcNumberContinueCharacters

Characters allowed in numbers.

public const string mcNumberContinueCharacters = "0123456789."

Field Value

string

mcNumberStartCharacters

Characters a number can start with.

public const string mcNumberStartCharacters = "+-0123456789."

Field Value

string

vbCr

Constant for carriage return (chr 13)

public const string vbCr = "\r"

Field Value

string

vbCrLf

Constant for carriage return/line feed (chr 13, chr 10)

public const string vbCrLf = "\r\n"

Field Value

string

vbLf

Constant for carriage line feed (chr 10)

public const string vbLf = "\n"

Field Value

string

vbNullChar

Constant for Null-character (chr 0)

public const char vbNullChar = '\0'

Field Value

char

vbTab

Constant for tab. (chr 9)

public const string vbTab = "\t"

Field Value

string

Properties

GetPerformanceCounter

public static long GetPerformanceCounter { get; }

Property Value

long

Time

public static DateTime Time { get; }

Property Value

DateTime

Methods

AddNumberToDate(DateTime, double)

public static DateTime AddNumberToDate(DateTime pDate, double pNumber)

Parameters

pDate DateTime
pNumber double

Returns

DateTime

Array(params object[])

public static object[] Array(params object[] pElements)

Parameters

pElements object[]

Returns

object[]

Array<T>(params T[])

public static T[] Array<T>(params T[] pElements)

Parameters

pElements T[]

Returns

T[]

Type Parameters

T

Asc(string)

public static int Asc(string pString)

Parameters

pString string

Returns

int

AssemblyPath()

public static string AssemblyPath()

Returns

string

Base32Decode(string)

public static string Base32Decode(string pBase32encodedString)

Parameters

pBase32encodedString string

Returns

string

Base32Encode(string)

public static string Base32Encode(string pUnicodeString)

Parameters

pUnicodeString string

Returns

string

Base64Decode(string)

public static string Base64Decode(string pBase64encodedString)

Parameters

pBase64encodedString string

Returns

string

Base64DecodeToBytes(string)

public static byte[] Base64DecodeToBytes(string pBase64encodedString)

Parameters

pBase64encodedString string

Returns

byte[]

Base64Encode(byte[])

public static string Base64Encode(byte[] pByteArray)

Parameters

pByteArray byte[]

Returns

string

Base64Encode(string)

public static string Base64Encode(string pUnicodeString)

Parameters

pUnicodeString string

Returns

string

BringInRange<T>(T, T, T)

Brings a value within the range defined by the pMinValue and pMaxValue.

public static T BringInRange<T>(T pValue, T pMinValue, T pMaxValue) where T : IComparable

Parameters

pValue T

The Source value

pMinValue T

The minimum allowed value.

pMaxValue T

The maximum allowed value

Returns

T

A value that is within the specified range.

Type Parameters

T

The type. Must be IComparable

ByteArrayToHex(byte[])

public static string ByteArrayToHex(byte[] hash)

Parameters

hash byte[]

Returns

string

ByteArrayToString(byte[])

public static string ByteArrayToString(byte[] pByteArray)

Parameters

pByteArray byte[]

Returns

string

CBool(object)

public static bool CBool(object pValue)

Parameters

pValue object

Returns

bool

Chr(int)

public static string Chr(int pCharNumber)

Parameters

pCharNumber int

Returns

string

CleanupString(string, string)

public static string CleanupString(string pInputString, string pAcceptedCharacters = "")

Parameters

pInputString string
pAcceptedCharacters string

Returns

string

ComposeString(string, int)

public static string ComposeString(string pCharacter, int pCharacterCount)

Parameters

pCharacter string
pCharacterCount int

Returns

string

CreateDottedString(string)

public static string CreateDottedString(string pInputString)

Parameters

pInputString string

Returns

string

CreateException(int, string, string)

public static Exception CreateException(int pErrorNumber, string pSource, string pMessage)

Parameters

pErrorNumber int
pSource string
pMessage string

Returns

Exception

CreateGUID(bool)

Creates a GUID string.

public static string CreateGUID(bool pRemoveDashes = true)

Parameters

pRemoveDashes bool

If True, the dashes are removed.

Returns

string

A string with a GUID.

CreateMD5hash(string)

public static string CreateMD5hash(string pMessage)

Parameters

pMessage string

Returns

string

CreateMutex(string)

public static Mutex CreateMutex(string pName)

Parameters

pName string

Returns

Mutex

CreateObject(string)

public static object CreateObject(string pClassName)

Parameters

pClassName string

Returns

object

CreatePath(string)

Creates the path in the file system.

public static bool CreatePath(string pPath)

Parameters

pPath string

The path to create.

Returns

bool

A boolean indicating success. Also returns True if the path already existed.

DateAdd(string, int, DateTime)

public static DateTime DateAdd(string pInterval, int pNumber, DateTime pDate)

Parameters

pInterval string
pNumber int
pDate DateTime

Returns

DateTime

DateSerial(int, int, int, int, int, int)

public static DateTime DateSerial(int pYear, int pMonth, int pDay, int pHour = 0, int pMinute = 0, int pSecond = 0)

Parameters

pYear int
pMonth int
pDay int
pHour int
pMinute int
pSecond int

Returns

DateTime

DateValue(DateTime)

Returns the date-part of the specified date/time.

public static DateTime DateValue(DateTime pInputDate)

Parameters

pInputDate DateTime

Returns

DateTime

DecimalVal(object)

Converts the specified string to a decimal number. Also accepts &H... and 0x... expressions for hex. Uses InvariantCulture (decimal dot).

public static decimal DecimalVal(object pValue)

Parameters

pValue object

The number to convert.

Returns

decimal

A number.

DecimalVal(string)

Converts the specified string to a decimal number. Also accepts &H... and 0x... expressions for hex. Uses InvariantCulture (decimal dot).

public static decimal DecimalVal(string pString)

Parameters

pString string

The number to convert.

Returns

decimal

A number.

DecryptRijndael(string, string, bool)

public static string DecryptRijndael(string pKey, string pBase64stringToDecrypt, bool pBinaryText = false)

Parameters

pKey string
pBase64stringToDecrypt string
pBinaryText bool

Returns

string

DeleteFile(string)

public static bool DeleteFile(string pPath)

Parameters

pPath string

Returns

bool

DynamicHasProperty(dynamic, string)

public static bool DynamicHasProperty(dynamic obj, string name)

Parameters

obj dynamic
name string

Returns

bool

EncryptRijndael(string, string, bool)

public static string EncryptRijndael(string pKey, string pTextToEncrypt, bool pBinaryText = false)

Parameters

pKey string
pTextToEncrypt string
pBinaryText bool

Returns

string

EscapeStringFromXML(string)

public static string EscapeStringFromXML(string pInputString)

Parameters

pInputString string

Returns

string

EscapeStringToHTML(string, bool)

public static string EscapeStringToHTML(string pInputString, bool pEscapeLineBreaks = false)

Parameters

pInputString string
pEscapeLineBreaks bool

Returns

string

EscapeStringToJSON(string)

public static string EscapeStringToJSON(string pInputString)

Parameters

pInputString string

Returns

string

EscapeStringToJavaScript(string)

public static string EscapeStringToJavaScript(string pInputString)

Parameters

pInputString string

Returns

string

EscapeStringToJavaScriptSimple(string)

public static string EscapeStringToJavaScriptSimple(string pInputString)

Parameters

pInputString string

Returns

string

EscapeStringToVBScript(string, bool)

public static string EscapeStringToVBScript(string pInputString, bool pRespectLineFeeds = false)

Parameters

pInputString string
pRespectLineFeeds bool

Returns

string

EscapeStringToXML(string)

public static string EscapeStringToXML(string pInputString)

Parameters

pInputString string

Returns

string

EscapeVBscriptStringParameter(string)

public static string EscapeVBscriptStringParameter(string pParameterValue)

Parameters

pParameterValue string

Returns

string

ExeName()

public static string ExeName()

Returns

string

ExePath()

public static string ExePath()

Returns

string

ExeVersion()

public static string ExeVersion()

Returns

string

ExeVersion_Coded()

public static string ExeVersion_Coded()

Returns

string

ExtendPath(string)

public static string ExtendPath(string pPath)

Parameters

pPath string

Returns

string

FileCopy(string, string)

public static bool FileCopy(string pSourcePath, string pDestinationPath)

Parameters

pSourcePath string
pDestinationPath string

Returns

bool

FileDateTime(string)

public static DateTime FileDateTime(string pPath)

Parameters

pPath string

Returns

DateTime

FromHTTPdate(string)

public static DateTime FromHTTPdate(this string pDate)

Parameters

pDate string

Returns

DateTime

FullExeName()

public static string FullExeName()

Returns

string

GPPS(string, string, string)

public static string GPPS(string pFileName, string pSectionName, string pKeyName)

Parameters

pFileName string
pSectionName string
pKeyName string

Returns

string

GenerateRandomKey(int)

Creates a new crypto-safe random key.

public static string GenerateRandomKey(int pKeyLength = 1)

Parameters

pKeyLength int

The key-length in 'blocks'. Values 1-16. Each block results in 16 characters hex data (64 bit key). A value of 4 can be used for 'long' keys (64 characters, 256 bits).

Returns

string

A hex string with random bytes.

GetCharacters(ref string, int)

public static string GetCharacters(ref string pInputString, int pCharcount = 1)

Parameters

pInputString string
pCharcount int

Returns

string

GetCommand(ref string, string, bool, bool, bool)

public static string GetCommand(ref string pInputLine, string pSepChar, bool pRecognizeSQLbrackets = false, bool pRecognizeSingleQuotes = false, bool pSearchQuote_SupportCurlyBrackets = false)

Parameters

pInputLine string
pSepChar string
pRecognizeSQLbrackets bool
pRecognizeSingleQuotes bool
pSearchQuote_SupportCurlyBrackets bool

Returns

string

GetCommand(ref string, string, ref string, bool, bool)

public static string GetCommand(ref string pInputLine, string pSepChar, ref string pErrorMessage, bool pRecognizeSQLbrackets = false, bool pRecognizeSingleQuotes = false)

Parameters

pInputLine string
pSepChar string
pErrorMessage string
pRecognizeSQLbrackets bool
pRecognizeSingleQuotes bool

Returns

string

GetCommand_Reverse(ref string, string)

public static string GetCommand_Reverse(ref string pInputLine, string pSepChar)

Parameters

pInputLine string
pSepChar string

Returns

string

GetCommand_Reverse(ref string, string, ref string, ref bool, bool, bool)

public static string GetCommand_Reverse(ref string pInputLine, string pSepChar, ref string pErrorMessage, ref bool pSepCharFound, bool pRecognizeSQLbrackets = false, bool pRecognizeSingleQuotes = false)

Parameters

pInputLine string
pSepChar string
pErrorMessage string
pSepCharFound bool
pRecognizeSQLbrackets bool
pRecognizeSingleQuotes bool

Returns

string

GetCurrentProcessId()

public static int GetCurrentProcessId()

Returns

int

GetErrorMessage(Exception)

public static string GetErrorMessage(Exception pException)

Parameters

pException Exception

Returns

string

GetFileExtension(string)

Gets the file extension from a (full) filename (without the dot).

public static string GetFileExtension(string pFileName)

Parameters

pFileName string

The full file name to get the file extension from, like: 'C:\temp\Photo.jpg'

Returns

string

The file extension, like: 'jpg'

GetFileName(string)

Gets the filename of a full filename (removes the folder).

public static string GetFileName(string pFileName)

Parameters

pFileName string

The full file name to get the file name from, like: 'C:\temp\Photo.jpg'

Returns

string

The file name, like: 'Photo.jpg'

GetFilePath(string)

Gets the path (containing folder) from a file name. Will end on a slash.

public static string GetFilePath(string pFileName)

Parameters

pFileName string

The name to get the path from. Like: 'C:\temp\Photo.jpg'

Returns

string

The path for the specified name. Like: 'C:\temp'

GetFileVersion(string)

public static string GetFileVersion(string pFilePath)

Parameters

pFilePath string

Returns

string

GetFreeSpace(string)

public static long GetFreeSpace(string pDisk)

Parameters

pDisk string

Returns

long

GetInternetDocument(string)

public static string GetInternetDocument(string pURL)

Parameters

pURL string

Returns

string

GetInternetDocument(string, ref string, string, Dictionary<string>, Dictionary<string>, int)

public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData, Dictionary<string> pHeaders, Dictionary<string> pReturnedHeaders, int pTimeoutMs = 0)

Parameters

pURL string
pErrorMessage string
pPostData string
pHeaders Dictionary<string>
pReturnedHeaders Dictionary<string>
pTimeoutMs int

Returns

string

GetInternetDocument(string, ref string, string, int)

public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData = "", int pTimeoutMs = 0)

Parameters

pURL string
pErrorMessage string
pPostData string
pTimeoutMs int

Returns

string

GetInternetDocument(string, ref string, string, string, ref string, ref string, int)

public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData, string pHeaders, ref string pReturnedHeaders, ref string pContentType_InOut, int pTimeoutMs = 0)

Parameters

pURL string
pErrorMessage string
pPostData string
pHeaders string
pReturnedHeaders string
pContentType_InOut string
pTimeoutMs int

Returns

string

GetItemFromCollection(dynamic, object)

public static object GetItemFromCollection(dynamic pCollection, object pIndex)

Parameters

pCollection dynamic
pIndex object

Returns

object

GetKeyword(ref string, bool, bool, bool, bool)

public static string GetKeyword(ref string pInputString, bool pIgnoreSpaces = true, bool pOptimizeForVBscriptParsing = false, bool pTreatPlusAndMinusAsOperators = false, bool pKeepSpacesAtRemainder = false)

Parameters

pInputString string
pIgnoreSpaces bool
pOptimizeForVBscriptParsing bool
pTreatPlusAndMinusAsOperators bool
pKeepSpacesAtRemainder bool

Returns

string

GetProcessMemory()

public static long GetProcessMemory()

Returns

long

GetStringPart(string, string, bool)

public static string GetStringPart(string pInputString, string pSepChar = "", bool pCompareBinary = false)

Parameters

pInputString string
pSepChar string
pCompareBinary bool

Returns

string

GetStringPart(ref string, string, bool)

public static string GetStringPart(ref string pInputString, string pSepChar = "", bool pCompareBinary = false)

Parameters

pInputString string
pSepChar string
pCompareBinary bool

Returns

string

GetTickCount()

public static int GetTickCount()

Returns

int

GetTickCount64()

public static long GetTickCount64()

Returns

long

GetVirtualProcessMemory()

public static long GetVirtualProcessMemory()

Returns

long

GetXMLnodeValue(XmlDocument, string, string)

public static string GetXMLnodeValue(XmlDocument pXMLdocument, string pNodePath, string pDefaultValue = "")

Parameters

pXMLdocument XmlDocument
pNodePath string
pDefaultValue string

Returns

string

GetXMLnodeValue(XmlNode, string, string)

public static string GetXMLnodeValue(XmlNode pXmlNode, string pNodePath, string pDefaultValue = "")

Parameters

pXmlNode XmlNode
pNodePath string
pDefaultValue string

Returns

string

HMAC_SHA1(byte[], byte[])

public static byte[] HMAC_SHA1(byte[] key, byte[] message)

Parameters

key byte[]
message byte[]

Returns

byte[]

HMAC_SHA1(string, string)

public static string HMAC_SHA1(string pKey, string pMessage)

Parameters

pKey string
pMessage string

Returns

string

HMAC_SHA1_HexKey(string, string)

public static string HMAC_SHA1_HexKey(string pKeyHex, string pMessage)

Parameters

pKeyHex string
pMessage string

Returns

string

HMAC_SHA256(byte[], byte[])

public static byte[] HMAC_SHA256(byte[] key, byte[] message)

Parameters

key byte[]
message byte[]

Returns

byte[]

HMAC_SHA256(string, string)

public static string HMAC_SHA256(string pKey, string pMessage)

Parameters

pKey string
pMessage string

Returns

string

HMAC_SHA256_HexKey(string, string)

public static string HMAC_SHA256_HexKey(string pKeyHex, string pMessage)

Parameters

pKeyHex string
pMessage string

Returns

string

HMAC_SHA512(byte[], byte[])

public static byte[] HMAC_SHA512(byte[] key, byte[] message)

Parameters

key byte[]
message byte[]

Returns

byte[]

HMAC_SHA512(string, string)

public static string HMAC_SHA512(string pKey, string pMessage)

Parameters

pKey string
pMessage string

Returns

string

HMAC_SHA512_HexKey(string, string)

public static string HMAC_SHA512_HexKey(string pKeyHex, string pMessage)

Parameters

pKeyHex string
pMessage string

Returns

string

HasWritePermissionOnFolderOrFile(string)

public static bool HasWritePermissionOnFolderOrFile(string pPathToFolderOrFile)

Parameters

pPathToFolderOrFile string

Returns

bool

Hex(byte)

public static string Hex(byte pNumber)

Parameters

pNumber byte

Returns

string

Hex(short)

public static string Hex(short pNumber)

Parameters

pNumber short

Returns

string

Hex(int)

public static string Hex(int pNumber)

Parameters

pNumber int

Returns

string

HexToByteArray(string)

public static byte[] HexToByteArray(string pHexData)

Parameters

pHexData string

Returns

byte[]

HexToNumber(string)

public static long HexToNumber(string pInputString)

Parameters

pInputString string

Returns

long

HexToString(string)

public static string HexToString(string pHexString)

Parameters

pHexString string

Returns

string

InStr(int, string, string, int)

public static int InStr(int pStart, string pSourceString, string pFindString, int pCompareMode = 0)

Parameters

pStart int
pSourceString string
pFindString string
pCompareMode int

Returns

int

InStr(string, string)

public static int InStr(string pSourceString, string pFindString)

Parameters

pSourceString string
pFindString string

Returns

int

InStrRev(string, string, int, int)

public static int InStrRev(string pSourceString, string pFindString, int pStart = -1, int pCompareMode = 0)

Parameters

pSourceString string
pFindString string
pStart int
pCompareMode int

Returns

int

In<T>(T, params T[])

public static bool In<T>(this T pCheckValue, params T[] pValues) where T : IComparable

Parameters

pCheckValue T
pValues T[]

Returns

bool

Type Parameters

T

Int(double)

public static int Int(double pValue)

Parameters

pValue double

Returns

int

IntVal(object)

Converts the specified pValue to a number and returns the integer value (using floor).

public static int IntVal(object pValue)

Parameters

pValue object

The value to convert.

Returns

int

An integer value.

IsHex(string)

public static bool IsHex(string pInputString)

Parameters

pInputString string

Returns

bool

IsLikeInt32(decimal)

public static bool IsLikeInt32(this decimal pValue)

Parameters

pValue decimal

Returns

bool

IsLikeInt32(double)

public static bool IsLikeInt32(this double pValue)

Parameters

pValue double

Returns

bool

IsLikeInt64(decimal)

public static bool IsLikeInt64(this decimal pValue)

Parameters

pValue decimal

Returns

bool

IsLikeInt64(double)

public static bool IsLikeInt64(this double pValue)

Parameters

pValue double

Returns

bool

IsNull(object)

public static bool IsNull(object pValue)

Parameters

pValue object

Returns

bool

IsNumeric(string)

public static bool IsNumeric(string pString)

Parameters

pString string

Returns

bool

IsNumericType(object)

public static bool IsNumericType(this object o)

Parameters

o object

Returns

bool

IsValidName(string, bool)

public static bool IsValidName(string pName, bool pAllowStartWithUnderscore = false)

Parameters

pName string
pAllowStartWithUnderscore bool

Returns

bool

IsValidNumber(string)

public static bool IsValidNumber(string pInputString)

Parameters

pInputString string

Returns

bool

ItemIn<T>(T, params T[])

public static bool ItemIn<T>(T pCheckValue, params T[] pValues) where T : IComparable

Parameters

pCheckValue T
pValues T[]

Returns

bool

Type Parameters

T

LCase(string)

public static string LCase(string pInputString)

Parameters

pInputString string

Returns

string

Left(string, int)

public static string Left(string pString, int pCharCount)

Parameters

pString string
pCharCount int

Returns

string

Len(string)

public static int Len(string pString)

Parameters

pString string

Returns

int

LetFolderNameEndOnSlash(string)

Take a foldername and makes sure it ends on a backwards slash (). If the name already ends on a slash, no extra slash is added.

public static string LetFolderNameEndOnSlash(string pFolderName)

Parameters

pFolderName string

The name of the folder, like 'C:\Temp'

Returns

string

The name of the folder ending on a slash, like: 'C:\Temp'

Like(string, string, bool)

public static bool Like(this string pInputString, string pMatchString, bool pCaseInSensitive = false)

Parameters

pInputString string
pMatchString string
pCaseInSensitive bool

Returns

bool

Long(int)

public static string Long(int pNumber)

Parameters

pNumber int

Returns

string

LongVal(object)

Converts the specified pValue to a number and returns the long value (using floor).

public static long LongVal(object pValue)

Parameters

pValue object

The value to convert.

Returns

long

A long value.

MakeNull(object)

Used to replace empty strings by DBNull values for fields that cannot contain zero-length strings.

public static object MakeNull(object pInputValue)

Parameters

pInputValue object

A value

Returns

object

NULL if pInputValue is an empty string or empty etc., else pInputValue is returned.

Max<T>(T, T)

Returns the maximum value from the two specified values.

public static T Max<T>(T pValue1, T pValue2) where T : IComparable

Parameters

pValue1 T
pValue2 T

Returns

T

Type Parameters

T

Merge(byte[], byte[])

public static byte[] Merge(this byte[] pSource, byte[] pAdditionalArray)

Parameters

pSource byte[]
pAdditionalArray byte[]

Returns

byte[]

MergeByteArrays(params byte[][])

public static byte[] MergeByteArrays(params byte[][] pArrays)

Parameters

pArrays byte[][]

Returns

byte[]

Mid(string, int, int, bool)

public static string Mid(string pInputString, int pStartPosition, int pLength = 1000000000, bool pZeroBased = false)

Parameters

pInputString string
pStartPosition int
pLength int
pZeroBased bool

Returns

string

Mid(string, int, int, string, bool)

public static string Mid(string pInputString, int pStartPosition, int pLength, string pReplacementValue, bool pZeroBased = false)

Parameters

pInputString string
pStartPosition int
pLength int
pReplacementValue string
pZeroBased bool

Returns

string

MidABS(string, int, int)

public static string MidABS(string pInputString, int pStartposition, int pEndPosition)

Parameters

pInputString string
pStartposition int
pEndPosition int

Returns

string

Min<T>(T, T)

Returns the minimum value from the to specified values.

public static T Min<T>(T pValue1, T pValue2) where T : IComparable

Parameters

pValue1 T
pValue2 T

Returns

T

Type Parameters

T

NewString(string)

public static clsString NewString(string pInitialValue = "")

Parameters

pInitialValue string

Returns

clsString

NoEmpty(string, string)

Returns pInputValue, except when pInputValue is null or an empty string, then pEmptyValue is returned.

public static string NoEmpty(string pInputValue, string pEmptyValue)

Parameters

pInputValue string

The input value.

pEmptyValue string

The value to use when pInputValue is null or empty.

Returns

string

NoNull(object, object)

Takes a value and returns the specified NullValue if the value was null (nothing) or NULL.

public static object NoNull(object pInputValue, object pNullValue)

Parameters

pInputValue object

The input value.

pNullValue object

The value to substitute if the InputValue is null or NULL

Returns

object

pInputValue ?? pNullValue.

OptionalLongVal(object)

Converts the specified pValue to a number and returns the long value (using floor). Returns null if the specified value is null or NULL or Empty.

public static long? OptionalLongVal(object pValue)

Parameters

pValue object

The value to convert.

Returns

long?

A long? value

Random(int)

public static int Random(int pTopBoundary)

Parameters

pTopBoundary int

Returns

int

Random(int, int)

public static int Random(int pInclusiveBottomBoundary, int pTopBoundary)

Parameters

pInclusiveBottomBoundary int
pTopBoundary int

Returns

int

ReDim<T>(T[], int, bool)

public static T[] ReDim<T>(T[] pVariable, int pNewSize, bool pPreserve = false)

Parameters

pVariable T[]
pNewSize int
pPreserve bool

Returns

T[]

Type Parameters

T

ReadFile(string, bool)

public static string ReadFile(string pPath, bool pReadBinary = true)

Parameters

pPath string
pReadBinary bool

Returns

string

ReadTag(string, string, string)

Reads a value from a tag

public static string ReadTag(string pTag, string pSetting, string pSepChar = "]")

Parameters

pTag string

The value of a tag, like '[Month=April][Type=Book][Color=Light blue]'

pSetting string

The name of the setting, including the start character and the separator, like '[Type='

pSepChar string

The character at the end of the settings, like ']'

Returns

string

The value of the named item, like 'Book' or an empty string if the setting is not found.

ReleaseMutex(Mutex)

public static void ReleaseMutex(Mutex pMutex)

Parameters

pMutex Mutex

RemoveSQLcomments(string)

public static string RemoveSQLcomments(string pSQLstring)

Parameters

pSQLstring string

Returns

string

RemoveUnicodeCharactersFromString(string, string)

public static string RemoveUnicodeCharactersFromString(string pString, string pReplacementCharacter)

Parameters

pString string
pReplacementCharacter string

Returns

string

RepairNumber(decimal)

public static decimal RepairNumber(decimal pValue)

Parameters

pValue decimal

Returns

decimal

RepairNumber(double)

public static double RepairNumber(double pValue)

Parameters

pValue double

Returns

double

Replace(string, string, string, int, int, int)

public static string Replace(string pSourceString, string pFindString, string pReplaceString, int pStartAt = 1, int pReplaceCount = -1, int pCompareMode = 0)

Parameters

pSourceString string
pFindString string
pReplaceString string
pStartAt int
pReplaceCount int
pCompareMode int

Returns

string

Right(string, int)

public static string Right(string pString, int pCharCount)

Parameters

pString string
pCharCount int

Returns

string

RoundUp(double, int)

Rounds a number to its nearest whole number away from zero (or the given decimals)

public static double RoundUp(this double pValue, int pDecimals)

Parameters

pValue double

The number to round.

pDecimals int

The desired precission.

Returns

double

The rounded number.

SYSTEMTIME()

public static DateTime SYSTEMTIME()

Returns

DateTime

SendDebug(params object[])

public static void SendDebug(params object[] pElements)

Parameters

pElements object[]

SetFileExtension(string, string)

Sets a different file extension for a file name.

public static string SetFileExtension(string pFilename, string pFileExtension)

Parameters

pFilename string

The full file name to set the file extension for, like: 'C:\temp\Photo.jpg'

pFileExtension string

The new file extension, like 'png'

Returns

string

The name with the new file extension, like: 'C:\temp\Photo.png'

SetTag(string, string, string, bool, string)

Sets a value in a tag.

public static string SetTag(string pTag, string pSetting, string value, bool pRemoveEmptySetting = false, string pSepChar = "]")

Parameters

pTag string

The initial value of the tag, like '[Month=April][Type=Book][Color=Light blue]'

pSetting string

The name of the setting, including the start character and the separator, like '[Type='

value string

The new value, like 'Movie'

pRemoveEmptySetting bool

Pass as True to remove a setting if the value is empty.

pSepChar string

The character at the end of the settings, like ']'

Returns

string

The new tag. Elements may get a different position. Like: [Month=April][Color=Light blue][Type=Movie]

Sha1(string)

public static string Sha1(string pMessage)

Parameters

pMessage string

Returns

string

Sha256(string)

public static string Sha256(string pMessage)

Parameters

pMessage string

Returns

string

Sha512(string)

public static string Sha512(string pMessage)

Parameters

pMessage string

Returns

string

Space(int)

public static string Space(int pSpaceCount)

Parameters

pSpaceCount int

Returns

string

Str(object)

Converts the specified value to a string representing this value. Uses InvariantCulture (decimal dot). Returns an empty string if the pNumber is not numeric.

public static string Str(object pNumber)

Parameters

pNumber object

The number to convert to a string.

Returns

string

A string for the specified number or an empty string.

StringHasUnicodeCharacters(string)

public static bool StringHasUnicodeCharacters(string pString)

Parameters

pString string

Returns

bool

StringToByteArray(string)

public static byte[] StringToByteArray(string pInputString)

Parameters

pInputString string

Returns

byte[]

StringToHex(string)

public static string StringToHex(string pInputString)

Parameters

pInputString string

Returns

string

StringToSQL(string)

public static string StringToSQL(string pString)

Parameters

pString string

Returns

string

StringToSQL_EmptyStringAsNULL(string)

public static string StringToSQL_EmptyStringAsNULL(string pString)

Parameters

pString string

Returns

string

StringToSQLname(string)

public static string StringToSQLname(string pName)

Parameters

pName string

Returns

string

StripFileExtension(string)

Returns the name of the given pFileName but removes the extension from the file name.

public static string StripFileExtension(string pFileName)

Parameters

pFileName string

The (full) filename. May include folders. Like: 'C:\temp\Photo.jpg'

Returns

string

The full filename without the extension. Like: 'C:\temp\Photo'

Swap<T>(ref T, ref T)

public static void Swap<T>(ref T pParameter1, ref T pParameter2)

Parameters

pParameter1 T
pParameter2 T

Type Parameters

T

SyncShell(string, int, bool, bool)

public static bool SyncShell(string pCommandLine, int pTimeOutTicks = 0, bool pWaitForInputIdle = false, bool pRunAsAdministrator = false)

Parameters

pCommandLine string
pTimeOutTicks int
pWaitForInputIdle bool
pRunAsAdministrator bool

Returns

bool

SyncShell(string, int, ref string, ref string, bool)

public static bool SyncShell(string pCommandLine, int pTimeOutTicks, ref string pResult, ref string pErrorMessage, bool pRunAsAdministrator)

Parameters

pCommandLine string
pTimeOutTicks int
pResult string
pErrorMessage string
pRunAsAdministrator bool

Returns

bool

SyncShell(string, ref string, int, bool)

public static bool SyncShell(string pCommandLine, ref string pResult, int pTimeOutTicks = 0, bool pRunAsAdministrator = false)

Parameters

pCommandLine string
pResult string
pTimeOutTicks int
pRunAsAdministrator bool

Returns

bool

SyncShell(string, ref string, ref string, int, bool)

public static bool SyncShell(string pCommandLine, ref string pResult, ref string pErrorMessage, int pTimeOutTicks = 0, bool pRunAsAdministrator = false)

Parameters

pCommandLine string
pResult string
pErrorMessage string
pTimeOutTicks int
pRunAsAdministrator bool

Returns

bool

SysDateToString(DateTime, SysDateToString_Format)

public static string SysDateToString(DateTime pInputDateTime, Globals.SysDateToString_Format pFormat = SysDateToString_Format.YYYYMMDDHHMMSS)

Parameters

pInputDateTime DateTime
pFormat Globals.SysDateToString_Format

Returns

string

SysStringToDate(string, SysDateToString_Format)

public static DateTime SysStringToDate(string pInputString, Globals.SysDateToString_Format pFormat = SysDateToString_Format.YYYYMMDDHHMMSS)

Parameters

pInputString string
pFormat Globals.SysDateToString_Format

Returns

DateTime

TimeSerial(int, int, int)

public static DateTime TimeSerial(int pHours, int pMinutes, int pSeconds)

Parameters

pHours int
pMinutes int
pSeconds int

Returns

DateTime

TimeValue(DateTime)

Returns the time-part of the specified date/time.

public static DateTime TimeValue(DateTime pInputDate)

Parameters

pInputDate DateTime

Returns

DateTime

ToHTTPdate(DateTime)

public static string ToHTTPdate(this DateTime pDate)

Parameters

pDate DateTime

Returns

string

ToTitleCase(string, bool)

public static string ToTitleCase(string pString, bool pRemoveSpaces = false)

Parameters

pString string
pRemoveSpaces bool

Returns

string

Trim(string)

public static string Trim(string pInputString)

Parameters

pInputString string

Returns

string

UBound(Array, int)

public static int UBound(Array pObject, int pDimension = 1)

Parameters

pObject Array
pDimension int

Returns

int

UCase(string)

public static string UCase(string pInputString)

Parameters

pInputString string

Returns

string

UTF8toUnicode(string)

public static string UTF8toUnicode(string pUnicodeString)

Parameters

pUnicodeString string

Returns

string

UnQuote(string)

If the trimmed source string starts and ends with a double quote, these quotes are removed.

public static string UnQuote(this string pString)

Parameters

pString string

Returns

string

UnSquareBracket(string)

If the trimmed source string starts and ends with a square bracked [..], these square brackets are removed.

public static string UnSquareBracket(this string pString)

Parameters

pString string

Returns

string

UnicodeToUTF8(string)

public static string UnicodeToUTF8(string pUnicodeString)

Parameters

pUnicodeString string

Returns

string

UrlDecode(string)

public static string UrlDecode(string pUrlEncodedString)

Parameters

pUrlEncodedString string

Returns

string

UrlEncode(string)

public static string UrlEncode(string pString)

Parameters

pString string

Returns

string

Val(object)

Converts the specified value to a number. Uses InvariantCulture (decimal dot).

public static double Val(object pValue)

Parameters

pValue object

The value to convert.

Returns

double

A number (double).

Val(string)

Converts the specified string to a number. Also accepts &H... and 0x... expressions for hex. Uses InvariantCulture (decimal dot).

public static double Val(string pString)

Parameters

pString string

The number to convert.

Returns

double

A number.

ValidateEmailAddress(ref string)

public static bool ValidateEmailAddress(ref string pEmailAddress)

Parameters

pEmailAddress string

Returns

bool

ValueToJSON(object)

public static string ValueToJSON(object pValue)

Parameters

pValue object

Returns

string

VbDayOfWeek(DateTime, int)

public static int VbDayOfWeek(DateTime pDateTime, int pFirstDayOfWeek)

Parameters

pDateTime DateTime
pFirstDayOfWeek int

Returns

int

VbWeekNumber(DateTime, int, int)

public static int VbWeekNumber(DateTime pDateTime, int pFirstWeekOfYear, int pFirstDayOfWeek)

Parameters

pDateTime DateTime
pFirstWeekOfYear int
pFirstDayOfWeek int

Returns

int

WPPS(string, string, string, string)

public static void WPPS(string pFileName, string pSectionName, string pKeyName, string value)

Parameters

pFileName string
pSectionName string
pKeyName string
value string

WriteFile(string, string, bool, bool)

public static string WriteFile(string pPath, string pContents, bool pCreatePath = false, bool pWriteBinary = true)

Parameters

pPath string
pContents string
pCreatePath bool
pWriteBinary bool

Returns

string

WriteLogLine(string, string, bool, bool)

Writes a line to a logfile as specified. If no filename is given, the file 'LogResults.txt' is used

public static void WriteLogLine(string pLine, string pFileName = "", bool pSuppressAddDateTime = false, bool pSuppressNewLine = false)

Parameters

pLine string

The line of text to write to the log.

pFileName string

The name of the file to write to. If no path is specified, the current exe-path is used. If nothing is specified, 'LogResults.txt' is used.

pSuppressAddDateTime bool

Pass as True to support adding the utc date time to the beginning of the line.

pSuppressNewLine bool

Pass as True to suppress adding a NewLine (Cr/Lf) to the end of the line. This way, the next WriteLogLine will continue on this line.