C-DEngine 5.105

TheCommonUtils Methods

The TheCommonUtils type exposes the following members.

Methods


  Name Description
Public method Static member BackupCache Obsolete.
Public method Static member CArray2UnicodeString(array<Byte>[]()[][])
Converts a Unicode-encoded byte array to a string.
Public method Static member CArray2UnicodeString(array<Byte>[]()[][], Int32, Int32)
Converts a portion of a Unicode-encoded byte array to a string.
Public method Static member CArray2UTF8String(array<Byte>[]()[][], Boolean)
Converts a byte array using UTF8 encoding to a character string.
Public method Static member CArray2UTF8String(array<Byte>[]()[][], Int32, Int32, Boolean)
Converts a byte array using UTF8 encoding to a character string.
Public method Static member CArray2UTF8String(array<Byte>[]()[][])
Converts a byte array using UTF8 encoding to a character string.
Public method Static member CArray2UTF8String(array<Byte>[]()[][], Int32, Int32)
Converts a byte array using UTF8 encoding to a character string.
Public method Static member CBool
Converts an object to boolean.
Public method Static member CByte
Converts an object to a byte.
Public method Static member CChar
Converts an object to a character.
Public method Static member CDate(String)
Converts a string to a date.
Public method Static member CDate(Object)
Convert an object to a date.
Public method Static member CDateNullable
Public method Static member CDateTimeToJSONDate
Converts an input date into the JSON Date(ticks) notation.
Public method Static member CDbl
Convert an object to double.
Public method Static member CDblWithBool
Converts an object to Double.
Public method Static member cdeBlockCopy
Abstracts Buffer.BlockCopy for older OS/.NET Versions
Public method Static member cdeCompressBuffer
Compress a portion of a byte array.
Public method Static member cdeCompressString
Compress a string to a byte array. Reverse the process by calling cdeDecompressToString.
Public method Static member cdeContainsCookie
Query a list of tokens for the presence of a specific token.
Public method Static member cdeCreateXMLElement(String, String)
Create an XML element.
Public method Static member cdeCreateXMLElement(String, array<Byte>[]()[][])
Create an XML element.
Public method Static member cdeDecompressToString(array<Byte>[]()[][])
Decompresses data that was originally compressed with a call to cdeCompressString.
Public method Static member cdeDecompressToString(array<Byte>[]()[][], Int32, Int32)
Decompress data from a portion of a byte array to a string.
Public method Static member cdeDecrypt
Public method Static member cdeDeleteAppSetting Obsolete.
Deletes a setting from the app.config
Public method Static member cdeDistinctCookies
Remove duplicates from a list of tokens.
Public method Static member cdeEncrypt(array<Byte>[]()[][], array<Byte>[]()[][])
Public method Static member cdeEncrypt(String, array<Byte>[]()[][])
Public method Static member cdeEscapeString
Add web address URL encoding.
Public method Static member cdeESCXML
Add escapes for XML special characters.
Public method Static member cdeESCXMLwBR
Add escapes for XML special characters plus newline break.
Public method Static member cdeFixupFileName(String)
Modify a file path as required to enable compatibilty across different target platforms.
Public method Static member cdeGetAppSetting(String, String, Boolean) Obsolete.
Retrieves a setting from the App.config/web.config "Configuration" Settings
Public method Static member cdeGetAppSetting(String, String, Boolean, Boolean) Obsolete.
Retrieves a setting from the App.config/web.config "Configuration" Settings
Public method Static member cdeGuidToString
Converts a Guid to a string.
Public method Static member cdeIsLocked
Quickly verifies whether an object holds a lock or not.
Public method Static member cdeJavaEncode
Removes Javascript special characters.
Public method Static member cdeJavaEncode4Code
Removes Javascript special characters.
Public method Static member cdeJavaEncode4Line
Removes Javascript special characters.
Public method Static member cdeNameValueToDirectory
Converst a NameValueCollection to a Dictionary
Public method Static member cdeOpenFile
Opens a file in the local filesystem securely. The file will ONLY be opened under clientbin The path is automatically set and fixed up for MONO and Linux environments
Public method Static member cdePartialEscapeString
Add escapes for back-slash and apostrophe.
Public method Static member cdeRSACreateKeys
Creates new RSA Keys
Public method Static member cdeRSADecrypt(Guid, String)
Returns a decrypted string agains the RSA Key stored in the session
Public method Static member cdeRSADecrypt(Guid, array<Byte>[]()[][])
Returns a decrypted string agains the RSA Key stored in the session
Public method Static member cdeRSADecryptWithKey
decrypts byte array with given string key
Public method Static member cdeRSAEncrypt
Encrypts a string against the RSA Key inside a session
Public method Static member cdeRSAEncryptWithKeys
Encrypt a string to a byte array using a given RSA Key
Public method Static member cdeRunAsync(String, Boolean, TheCommonUtils..::..cdeWaitCallback, Object)
Runs code asynchronously without waiting for the result.
Public method Static member cdeRunTaskAsync
Runs code asynchronously and lets the caller wait for the code to finish
Public method Static member cdeRunTaskChainAsync
Runs a sequence of asynchronous tasks (task continuations or a method that uses the C# async keyword) and lets the caller wait for the entire chain to finish. The call returns immediately and not when the first continuation is hit.
Public method Static member cdeSplit(String, Char, Boolean, Boolean)
Converts a string into a string array. if you don't need the Remove.. parameter, please use .NET .split() function. if you need the remove... parameter use the override with the string sep(erator)
Public method Static member cdeSplit(String, String, Boolean, Boolean)
Converts a string into a string array.
Public method Static member cdeStripHTML
Process a string to remove all HTML tags.
Public method Static member cdeStripIllegalChars
Removes the return, linefeed, and tab characters from a string.
Public method Static member cdeSubstringMax
Truncates strings longer than a specified maximum length.
Public method Static member cdeTruncate(Single, Int32)
Truncates a Float to the amount of digits specified.
Public method Static member cdeTruncate(Double, Int32)
Truncates a double to the amount of digits specified.
Public method Static member cdeUnescapeString
Remove web address URL encoding.
Public method Static member cdeUnESCXML
Remove XML special character escapes.
Public method Static member cdeUUIDtoGuid
Normalize a UUID to conform to the Microsoft GUID format.
Public method Static member CFloat
Converts an object to a float.
Public method Static member CGuid
Converts an object to a Guid.
Public method Static member CGuidNullable
Public method Static member CInt
Converts an object to a signed short integer.
Public method Static member CIntNullable
Public method Static member CJSONDateToDateTime
Converts a JSON notation date 'Date(ticks)' to a DateTimeOffset value. Supports input like this: "Date(1335205592410)" Or this: "\"\\/Date(1335205592410-0500)\\/", as produced by the .NET DataContractJsonSerializer.
Public method Static member CLeft
Returns a specified number of characters from the left side of a string.
Public method Static member CListToString(ICollection<(Of <<'(String>)>>), String)
Converts a collection into a string.
Public method Static member CListToString(List<(Of <<'(String>)>>), String)
Converts a collection into a string.
Public method Static member CListToString(array<String>[]()[][], String)
Converts an array of strings a single string.
Public method Static member CListToString<(Of <<'(T>)>>)(ICollection<(Of <<'(T>)>>), String)
Converts a collection into a string.
Public method Static member CLng
Converts an object to signed long integer.
Public method Static member ClonePublic<(Of <<'(T>)>>)
Create a shallow copy of an object.
Public method Static member CreateDirectories(String)
Creates nested folder hierarchy for a file being created.
Public method Static member CreateDirectories(String, Boolean)
Creates folder hierarchy, optionally omitting file name.
Public method Static member CSByte
Converts an object to an 8-bit signed integer.
Public method Static member CSCDecrypt2GUID
Public method Static member CShort
Converts an object to a short signed integer.
Public method Static member CStr
Converts an object to a string.
Public method Static member CStringPosInStringList
Search for a token in a compound string,
Public method Static member CStringToByteArray
Convert a string to a byte array.
Public method Static member CStringToList
Split a string into a list.
Public method Static member CStringToMemoryStream
Convert a Unicode-encoded string to a memory stream.
Public method Static member CStrNullable
Public method Static member CTimeSpan
Converts an incoming object to a TimeSpan
Public method Static member CUInt
Converts an object to an unsigned integer.
Public method Static member CULng
Converts an object to an unsigned long integer.
Public method Static member CUnicodeString2Array
Converts a string into a byte array using Unicode encoding.
Public method Static member CUri
Safely converts an object (likely a string) to a System.Uri object.
Public method Static member CUShort
Converts an object to an unsigned short integer.
Public method Static member CUTF8String2Array
Converts a string to a byte array using UTF8 encoding.
Public method Static member DecryptKV
Decrypt incoming buffer array to a Dictionary.
Public method Static member DecryptToString
Decrypts a byte array to a string using internal AES encryption
Public method Static member DecryptWithConnToken
Decrypts an encrypted string against a given token GUID
Public method Static member DeserializeJSONStringToObject<(Of <<'(T>)>>)
Deserializes an object from a JSON string
Public method Static member DoesContainLocalhost(String)
Determines whether any of the URLs in the provided input string are a reference to the current host. Note that this function always ignores the hard-coded value of "LOCALHOST".
Public method Static member DoesContainLocalhost(String, Boolean)
Determines whether any of the URLs in the provided input string are a reference to the current host.
Public method Static member DoFireEvent<(Of <<'(T>)>>)(Action<(Of <<'(T>)>>), T, Boolean, Int32)
New in V4.105: Allows to fire a generic event on all supported platforms
Public method Static member DoFireEvent<(Of <<'(T>)>>)(Action<(Of <<'(T, Object>)>>), T, Object, Boolean, Int32)
New in V4.105: Allows to fire a generic event on all supported platforms
Public method Static member DoUrlsContainAnyUrl
Cross-check two strings containing one or more Guids separated by semi-colons, searching for any match between the two lists.
Public method Static member EncryptKV
Encryptes a dictionary to a byte array
Public method Static member EncryptWithConnToken
Encrypts a string against a token GUID
Public method Static member GenerateFinalStr(String)
Performs macro substitutions to generate a final output string.
Public method Static member GenerateFinalStr(String, ICDEThing)
Performs macro substitutions to generate a final output string.
Public method Static member GenerateFinalStr(String, ICDEThing, CultureInfo)
Performs macro substitutions to generate a final output string.
Public method Static member GetAggregateExceptionMessage(Exception)
Retrieve exception details in a string, including the stack trace.
Public method Static member GetAggregateExceptionMessage(Exception, Boolean)
Retrieve exception details in a string, optionally including the stack trace.
Public method Static member GetAnyFile
NEWV4: Returns a known http resource on this node (TODOV4: Security Review)
Public method Static member GetAssemblyPlatform(Assembly, Boolean, String%)
Public method Static member GetAssemblyPlatformHostAgnostic
Public method Static member GetAssemblyVersion
Request the version number of a specific plugin.
Public method Static member GetCalendarweek
Returns the Calendar Week for a given DateTime. The calculation is done using Sunday as the first day of the week, and first week as the one with at least four days.
Public method Static member GetCmdArgValue Obsolete.
Retrieves a Value for a Key provided at application host startup for values provided as parameters in the call to TheBaseApplication.StartBaseApplication.
Public method Static member GetDateTimeString(DateTimeOffset, Guid, String)
Formats a date as a string.
Public method Static member GetDateTimeString(DateTimeOffset, Int32, String)
Returns a cultural correct string representation of a DateTimeOffset. Only use for Displaying DateTimeOffsets in UX! Do not use for Messaging or Storage!
Public method Static member GetDeviceIDML(Guid, String)
Gets a Markup encoded version of a DeviceID for the System Log. If "ShowMInLog" is true. Otherwise just returns the pDeviceID.ToString()
Public method Static member GetDeviceIDML(String, String)
Gets a Markup encoded version of all DeviceIDs in an ORG for the System Log. If "ShowMInLog" is true. Otherwise just returns the pORG
Public method Static member GetFirstURL
Parse a string containing a list of Guid values for the first one in the list.
Public method Static member GetJSONValueByPath
Retrieves a value from a parsed JSON data structure based on a JSON path lookup/query. Obtain the parsed JSON using TheCommonUtils.DeserializeJSONStringToObject(). JSON Path details follow those in NewtonSoft's JObject.SelectToken().
Public method Static member GetLastURL
Parse a string containing a list of Guid values for the last one in the list.
Public method Static member GetLCID(TheProcessMessage)
Query for an LCID.
Public method Static member GetMaxMessageSize
Returns the Maximum Message Size allowed for a given SenderType
Public method Static member GetMimeTypeFromExtension
Query for a mime type from a file extension.
Public method Static member GetMyNodeName
Returns the Node Name of this node
Public method Static member GetNodeById
Parse a string containing a list of Guid values for the Nth one in the list.
Public method Static member GetPropValue
Returns the value of a property.
Public method Static member GetQueryPart
A dictionary lookup.
Public method Static member GetRandomDouble
Generate a pseudo-random number.
Public method Static member GetRandomUInt
Generate a pseudo-random number.
Public method Static member GetSafeFileName
Returns a file name where all reserved characters are replaced with underscore ("_"). Optionally add a timestamp to the file name. Example: GetSafeFileName("a+b:c/d", "json", true) returns a+b_c_d_201801241106123.json.
Public method Static member GetSetting Obsolete.
Returns a setting either known in the current Settings array or set as an environment variable or in App.Config First it looks into App.config and if this does not contain the setting it falls back to the existing MySettings and if that does not have the entry it looks in the environment variables.
Public method Static member GetStackInfo
A debug helper to format the call stack in HTML.
Public method Static member GetStringSection
Retrieves a section of a string given the parameter of this function. Can be used to parse HTML or other string snippets.
Public method Static member GetSystemResource
Fetch a resource from an assembly file.
Public method Static member GetTimeStamp
Returns a TimeStamp that can be used for Files up to the millisecond.
Public method Static member GetWebPlatform
Returns the eWebPlatform of a given UserAgent
Public method Static member GetXMLSection
Extract a section from a string containing XML. The section consists of everything between an opening and a closing tag (but not including the tag itself).
Public method Static member IsDeviceSenderType
Returns true if a sendery type is a device
Public method Static member IsGuid
Check for a Guid.
Public method Static member IsHostADevice
Query whether the current host is an end-user device or not, such as a browser or a phone.
Public method Static member IsLocalhost
Determines whether a node ID references the current host.
Public method Static member IsMobileDevice
Returns true if the UserAgent is a mobile device.
Public method Static member IsMono
Only use this method if you need to know if you are running in the MONO Runtime. If you want to find out if you are running on Linux use TheCommonUtils.cdeIsFileSystemCaseSensitive or IsOnLinux insted
Public method Static member IsMonoRT
Only use this method if you need to know if you are running in the MONO Runtime. If you want to find out if you are running on Linux use TheCommonUtils.cdeIsFileSystemCaseSensitive or IsOnLinux insted
Public method Static member IsNetCore
Detect the presence of the portable .NET Core platform.
Public method Static member IsNullOrWhiteSpace
Safe check for strings with no content.
This function provides a platform-independent way to validate string references. It enables support for String.IsNullOrWhiteSpace() under the .NET Framework version 3.5.
Public method Static member IsOnLinux
Query whether underlying platform is Linux.
Public method Static member IsOnMAC
Query whether underlying platform is Apple Mac OS.
Public method Static member IsUrlLocalhost
Determines whether provided URL specifies the current host on which process is running.
Public method Static member JsonConvertSerializeObject<(Of <<'(T>)>>)
Uses JsonConvert.SerializeObject to serialize an object to JSON. (New in V4).
Public method Static member LoadBlobFromDisk(IBaseEngine, String)
Loads the content of a file into a byte array owned by a plugin
Public method Static member LoadStringFromDisk(IBaseEngine, String)
Loads the content of a file into a string owned by a plugin
Public method Static member LoadStringFromDisk(String, String)
Loads the content of a file using a given path (under ClientBin)
Public method Static member LogSession
Logs a session in the Session log for this Application in the StorageService If there is no StorageService Role defined for this application this call does not do anything
Public method Static member ParseQueryString
Parse a web address for parameters.
Public method Static member RestoreCache Obsolete.
Public method Static member Rotate2D
Rotates a point in 2-dimensional space around an arbitrary rotation point by the number the specified angle of rotation.
Public method Static member RoundDateToMinuteInterval
Rounds a date value to a given minute interval.
Public method Static member RoundDateToSecondInterval
Rounds a date value to a given second interval.
Public method Static member SaveBlobToDisk(IBaseEngine, TSM, array<String>[]()[][])
Saves a message to disk in a directory for a given plugin
Public method Static member SerializeObjectToJSONString<(Of <<'(T>)>>)
Serializes an object/class to JSON.
Public method Static member SleepOneEye
A safe sleep function.
Public method Static member SleepOneEyeCancel
Set the cancel token to a 'signaled' state.
Public method Static member SleepOneEyeGetCancelToken
Creates a cancel token for C-DEngine safe sleep functions.
Public method Static member SleepOneEyeWithCancel
A safe sleep function.
Public method Static member TaskDelayOneEye(Int32, UInt32)
A safe sleep function.
Public method Static member TaskDelayOneEye(Int32, UInt32, Nullable<(Of <<'(CancellationToken>)>>))
A safe sleep function.
Public method Static member TaskFromException
Retrieves the task that was running when an exception occured.
Public method Static member TaskFromResult<(Of <<'(T>)>>)
A portable helper function that resolves platform-specific differences in the handling of System.Threading.Tasks.Task.Result.
Public method Static member TaskWaitCancel
Returns a task that completes when the task completes or the cancelToken was canceled. Note that the underlying task will NOT be canceled, only the await/Wait for the returned task will be canceled.
Public method Static member TaskWaitTimeout(Task, TimeSpan)
Returns a task that completes when the task completes or a timeout occurrs.
Public method Static member TaskWaitTimeout(Task, TimeSpan, Nullable<(Of <<'(CancellationToken>)>>))
Returns a task that completes when the task completes or a timeout occurrs.
Public method Static member TaskWhenAll
Creates a task that completes when all of the provided tasks are complete.
Public method Static member TaskWhenAny
Creates a task that completes when any of the provided tasks completes.
Public method Static member ToHexByte
Convert a hex string into a byte array.
Public method Static member ToHexString
Convert a byte array into a hex string.
Public method Static member TruncTrailingSlash
Removes a trailing slash from a URL.