TheCommonUtils Members
The TheCommonUtils type exposes the following members.
Methods
Name | Description | |
---|---|---|
BackupCache | Obsolete. | |
CArray2UnicodeString(array<Byte>[]()[][]) |
Converts a Unicode-encoded byte array to a string.
|
|
CArray2UnicodeString(array<Byte>[]()[][], Int32, Int32) |
Converts a portion of a Unicode-encoded byte array to a string.
|
|
CArray2UTF8String(array<Byte>[]()[][], Boolean) |
Converts a byte array using UTF8 encoding to a character string.
|
|
CArray2UTF8String(array<Byte>[]()[][], Int32, Int32, Boolean) |
Converts a byte array using UTF8 encoding to a character string.
|
|
CArray2UTF8String(array<Byte>[]()[][]) |
Converts a byte array using UTF8 encoding to a character string.
|
|
CArray2UTF8String(array<Byte>[]()[][], Int32, Int32) |
Converts a byte array using UTF8 encoding to a character string.
|
|
CBool |
Converts an object to boolean.
|
|
CByte |
Converts an object to a byte.
|
|
CChar |
Converts an object to a character.
|
|
CDate(String) |
Converts a string to a date.
|
|
CDate(Object) |
Convert an object to a date.
|
|
CDateNullable | ||
CDateTimeToJSONDate |
Converts an input date into the JSON Date(ticks) notation.
|
|
CDbl |
Convert an object to double.
|
|
CDblWithBool |
Converts an object to Double.
|
|
cdeBlockCopy |
Abstracts Buffer.BlockCopy for older OS/.NET Versions
|
|
cdeCompressBuffer |
Compress a portion of a byte array.
|
|
cdeCompressString |
Compress a string to a byte array. Reverse the process by calling cdeDecompressToString.
|
|
cdeContainsCookie |
Query a list of tokens for the presence of a specific token.
|
|
cdeCreateXMLElement(String, String) |
Create an XML element.
|
|
cdeCreateXMLElement(String, array<Byte>[]()[][]) |
Create an XML element.
|
|
cdeDecompressToString(array<Byte>[]()[][]) |
Decompresses data that was originally compressed with a call to cdeCompressString.
|
|
cdeDecompressToString(array<Byte>[]()[][], Int32, Int32) |
Decompress data from a portion of a byte array to a string.
|
|
cdeDecrypt | ||
cdeDeleteAppSetting | Obsolete.
Deletes a setting from the app.config
|
|
cdeDistinctCookies |
Remove duplicates from a list of tokens.
|
|
cdeEncrypt(array<Byte>[]()[][], array<Byte>[]()[][]) | ||
cdeEncrypt(String, array<Byte>[]()[][]) | ||
cdeEscapeString |
Add web address URL encoding.
|
|
cdeESCXML |
Add escapes for XML special characters.
|
|
cdeESCXMLwBR |
Add escapes for XML special characters plus newline break.
|
|
cdeFixupFileName(String) |
Modify a file path as required to enable compatibilty across different
target platforms.
|
|
cdeGetAppSetting(String, String, Boolean) | Obsolete.
Retrieves a setting from the App.config/web.config "Configuration" Settings
|
|
cdeGetAppSetting(String, String, Boolean, Boolean) | Obsolete.
Retrieves a setting from the App.config/web.config "Configuration" Settings
|
|
cdeGuidToString |
Converts a Guid to a string.
|
|
cdeIsLocked |
Quickly verifies whether an object holds a lock or not.
|
|
cdeJavaEncode |
Removes Javascript special characters.
|
|
cdeJavaEncode4Code |
Removes Javascript special characters.
|
|
cdeJavaEncode4Line |
Removes Javascript special characters.
|
|
cdeNameValueToDirectory |
Converst a NameValueCollection to a Dictionary
|
|
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
|
|
cdePartialEscapeString |
Add escapes for back-slash and apostrophe.
|
|
cdeRSACreateKeys |
Creates new RSA Keys
|
|
cdeRSADecrypt(Guid, String) |
Returns a decrypted string agains the RSA Key stored in the session
|
|
cdeRSADecrypt(Guid, array<Byte>[]()[][]) |
Returns a decrypted string agains the RSA Key stored in the session
|
|
cdeRSADecryptWithKey |
decrypts byte array with given string key
|
|
cdeRSAEncrypt |
Encrypts a string against the RSA Key inside a session
|
|
cdeRSAEncryptWithKeys |
Encrypt a string to a byte array using a given RSA Key
|
|
cdeRunAsync(String, Boolean, TheCommonUtils..::..cdeWaitCallback, Object) |
Runs code asynchronously without waiting for the result.
|
|
cdeRunTaskAsync |
Runs code asynchronously and lets the caller wait for the code to finish
|
|
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.
|
|
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)
|
|
cdeSplit(String, String, Boolean, Boolean) |
Converts a string into a string array.
|
|
cdeStripHTML |
Process a string to remove all HTML tags.
|
|
cdeStripIllegalChars |
Removes the return, linefeed, and tab characters from a string.
|
|
cdeSubstringMax |
Truncates strings longer than a specified maximum length.
|
|
cdeTruncate(Single, Int32) |
Truncates a Float to the amount of digits specified.
|
|
cdeTruncate(Double, Int32) |
Truncates a double to the amount of digits specified.
|
|
cdeUnescapeString |
Remove web address URL encoding.
|
|
cdeUnESCXML |
Remove XML special character escapes.
|
|
cdeUUIDtoGuid |
Normalize a UUID to conform to the Microsoft GUID format.
|
|
CFloat |
Converts an object to a float.
|
|
CGuid |
Converts an object to a Guid.
|
|
CGuidNullable | ||
CInt |
Converts an object to a signed short integer.
|
|
CIntNullable | ||
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.
|
|
CLeft |
Returns a specified number of characters from the left side of a string.
|
|
CListToString(ICollection<(Of <<'(String>)>>), String) |
Converts a collection into a string.
|
|
CListToString(List<(Of <<'(String>)>>), String) |
Converts a collection into a string.
|
|
CListToString(array<String>[]()[][], String) |
Converts an array of strings a single string.
|
|
CListToString<(Of <<'(T>)>>)(ICollection<(Of <<'(T>)>>), String) |
Converts a collection into a string.
|
|
CLng |
Converts an object to signed long integer.
|
|
ClonePublic<(Of <<'(T>)>>) |
Create a shallow copy of an object.
|
|
CreateDirectories(String) |
Creates nested folder hierarchy for a file being created.
|
|
CreateDirectories(String, Boolean) |
Creates folder hierarchy, optionally omitting file name.
|
|
CSByte |
Converts an object to an 8-bit signed integer.
|
|
CSCDecrypt2GUID | ||
CShort |
Converts an object to a short signed integer.
|
|
CStr |
Converts an object to a string.
|
|
CStringPosInStringList |
Search for a token in a compound string,
|
|
CStringToByteArray |
Convert a string to a byte array.
|
|
CStringToList |
Split a string into a list.
|
|
CStringToMemoryStream |
Convert a Unicode-encoded string to a memory stream.
|
|
CStrNullable | ||
CTimeSpan |
Converts an incoming object to a TimeSpan
|
|
CUInt |
Converts an object to an unsigned integer.
|
|
CULng |
Converts an object to an unsigned long integer.
|
|
CUnicodeString2Array |
Converts a string into a byte array using Unicode encoding.
|
|
CUri |
Safely converts an object (likely a string) to a System.Uri object.
|
|
CUShort |
Converts an object to an unsigned short integer.
|
|
CUTF8String2Array |
Converts a string to a byte array using UTF8 encoding.
|
|
DecryptKV |
Decrypt incoming buffer array to a Dictionary.
|
|
DecryptToString |
Decrypts a byte array to a string using internal AES encryption
|
|
DecryptWithConnToken |
Decrypts an encrypted string against a given token GUID
|
|
DeserializeJSONStringToObject<(Of <<'(T>)>>) |
Deserializes an object from a JSON string
|
|
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".
|
|
DoesContainLocalhost(String, Boolean) |
Determines whether any of the URLs in the provided input string are a reference to the current host.
|
|
DoFireEvent<(Of <<'(T>)>>)(Action<(Of <<'(T>)>>), T, Boolean, Int32) |
New in V4.105: Allows to fire a generic event on all supported platforms
|
|
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
|
|
DoUrlsContainAnyUrl |
Cross-check two strings containing one or more Guids
separated by semi-colons, searching for any match between
the two lists.
|
|
EncryptKV |
Encryptes a dictionary to a byte array
|
|
EncryptWithConnToken |
Encrypts a string against a token GUID
|
|
GenerateFinalStr(String) |
Performs macro substitutions to generate a final output string.
|
|
GenerateFinalStr(String, ICDEThing) |
Performs macro substitutions to generate a final output string.
|
|
GenerateFinalStr(String, ICDEThing, CultureInfo) |
Performs macro substitutions to generate a final output string.
|
|
GetAggregateExceptionMessage(Exception) |
Retrieve exception details in a string, including the stack trace.
|
|
GetAggregateExceptionMessage(Exception, Boolean) |
Retrieve exception details in a string, optionally including the stack trace.
|
|
GetAnyFile |
NEWV4: Returns a known http resource on this node (TODOV4: Security Review)
|
|
GetAssemblyPlatform(Assembly, Boolean, String%) | ||
GetAssemblyPlatformHostAgnostic | ||
GetAssemblyVersion |
Request the version number of a specific plugin.
|
|
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.
|
|
GetCmdArgValue | Obsolete.
Retrieves a Value for a Key provided at application host startup for values
provided as parameters in the call to TheBaseApplication.StartBaseApplication.
|
|
GetDateTimeString(DateTimeOffset, Guid, String) |
Formats a date as a string.
|
|
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!
|
|
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()
|
|
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
|
|
GetFirstURL |
Parse a string containing a list of Guid values for the first one in the list.
|
|
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().
|
|
GetLastURL |
Parse a string containing a list of Guid values for the last one in the list.
|
|
GetLCID(TheProcessMessage) |
Query for an LCID.
|
|
GetMaxMessageSize |
Returns the Maximum Message Size allowed for a given SenderType
|
|
GetMimeTypeFromExtension |
Query for a mime type from a file extension.
|
|
GetMyNodeName |
Returns the Node Name of this node
|
|
GetNodeById |
Parse a string containing a list of Guid values for the Nth one in the list.
|
|
GetPropValue |
Returns the value of a property.
|
|
GetQueryPart |
A dictionary lookup.
|
|
GetRandomDouble |
Generate a pseudo-random number.
|
|
GetRandomUInt |
Generate a pseudo-random number.
|
|
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.
|
|
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.
|
|
GetStackInfo |
A debug helper to format the call stack in HTML.
|
|
GetStringSection |
Retrieves a section of a string given the parameter of this function. Can be used to parse HTML or other string snippets.
|
|
GetSystemResource |
Fetch a resource from an assembly file.
|
|
GetTimeStamp |
Returns a TimeStamp that can be used for Files up to the millisecond.
|
|
GetWebPlatform |
Returns the eWebPlatform of a given UserAgent
|
|
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).
|
|
IsDeviceSenderType |
Returns true if a sendery type is a device
|
|
IsGuid |
Check for a Guid.
|
|
IsHostADevice |
Query whether the current host is an end-user device or not, such
as a browser or a phone.
|
|
IsLocalhost |
Determines whether a node ID references the current host.
|
|
IsMobileDevice |
Returns true if the UserAgent is a mobile device.
|
|
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
|
|
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
|
|
IsNetCore |
Detect the presence of the portable .NET Core platform.
|
|
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.
|
|
IsOnLinux |
Query whether underlying platform is Linux.
|
|
IsOnMAC |
Query whether underlying platform is Apple Mac OS.
|
|
IsUrlLocalhost |
Determines whether provided URL specifies the current host on which process is running.
|
|
JsonConvertSerializeObject<(Of <<'(T>)>>) |
Uses JsonConvert.SerializeObject to serialize an object to JSON. (New in V4).
|
|
LoadBlobFromDisk(IBaseEngine, String) |
Loads the content of a file into a byte array owned by a plugin
|
|
LoadStringFromDisk(IBaseEngine, String) |
Loads the content of a file into a string owned by a plugin
|
|
LoadStringFromDisk(String, String) |
Loads the content of a file using a given path (under ClientBin)
|
|
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
|
|
ParseQueryString |
Parse a web address for parameters.
|
|
RestoreCache | Obsolete. | |
Rotate2D |
Rotates a point in 2-dimensional space around an arbitrary
rotation point by the number the specified angle of rotation.
|
|
RoundDateToMinuteInterval |
Rounds a date value to a given minute interval.
|
|
RoundDateToSecondInterval |
Rounds a date value to a given second interval.
|
|
SaveBlobToDisk(IBaseEngine, TSM, array<String>[]()[][]) |
Saves a message to disk in a directory for a given plugin
|
|
SerializeObjectToJSONString<(Of <<'(T>)>>) |
Serializes an object/class to JSON.
|
|
SleepOneEye |
A safe sleep function.
|
|
SleepOneEyeCancel |
Set the cancel token to a 'signaled' state.
|
|
SleepOneEyeGetCancelToken |
Creates a cancel token for C-DEngine safe sleep functions.
|
|
SleepOneEyeWithCancel |
A safe sleep function.
|
|
TaskDelayOneEye(Int32, UInt32) |
A safe sleep function.
|
|
TaskDelayOneEye(Int32, UInt32, Nullable<(Of <<'(CancellationToken>)>>)) |
A safe sleep function.
|
|
TaskFromException |
Retrieves the task that was running when an exception occured.
|
|
TaskFromResult<(Of <<'(T>)>>) |
A portable helper function that resolves platform-specific differences in the handling of System.Threading.Tasks.Task.Result.
|
|
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.
|
|
TaskWaitTimeout(Task, TimeSpan) |
Returns a task that completes when the task completes or a timeout occurrs.
|
|
TaskWaitTimeout(Task, TimeSpan, Nullable<(Of <<'(CancellationToken>)>>)) |
Returns a task that completes when the task completes or a timeout occurrs.
|
|
TaskWhenAll |
Creates a task that completes when all of the provided tasks are complete.
|
|
TaskWhenAny |
Creates a task that completes when any of the provided tasks completes.
|
|
ToHexByte |
Convert a hex string into a byte array.
|
|
ToHexString |
Convert a byte array into a hex string.
|
|
TruncTrailingSlash |
Removes a trailing slash from a URL.
|