[This is preliminary documentation and is subject to change.]
The MiscUtils type exposes the following members.Methods
| Name | Description | |
|---|---|---|
| AllFileNames |
Walks all file names in a directory
| |
| AllFileNamesThatMatch |
Walks all file names that match the pattern in a directory
| |
| AppendFormatLine(StringBuilder, String, Object) |
Appends the string followed by new line and returned by processing a composite format string, which contains zero or more format items, to this instance.
Each format item is replaced by the string representation of a single argument.
| |
| AppendFormatLine(StringBuilder, String, Object ) |
Appends the string followed by new line and returned by processing a composite format string, which contains zero or more format items, to this instance.
Each format item is replaced by the string representation of a single argument.
| |
| AppendFormatLine(StringBuilder, String, Object, Object) |
Appends the string followed by new line and returned by processing a composite format string, which contains zero or more format items, to this instance.
Each format item is replaced by the string representation of a single argument.
| |
| AppendFormatLine(StringBuilder, String, Object, Object, Object) |
Appends the string followed by new line and returned by processing a composite format string, which contains zero or more format items, to this instance.
Each format item is replaced by the string representation of a single argument.
| |
| Args |
Shortcut helper for string.Format(tpl, params object[] args)
| |
| ArgsTpl(String, Object) |
Interprets template of the form: Some text {@value_name@:C} by replacing with property/field values.
Note: this function does not recognize escapes for simplicity (as escapes can be replaced by regular strings instead)
| |
| ArgsTpl(String, Object, Boolean ) |
Interprets template of the form: Some text {@value_name@:C} by replacing with property/field values.
Note: this function does not recognize escapes for simplicity (as escapes can be replaced by regular strings instead).
Matched is set to true if at least one property match was made
| |
| Burmatographize |
Swaps string letters that "obfuscates" string- usefull for generation of keys from strings that have to become non-obvious to user.
This function does not offer any real protection (as it is easy to decipher the original value), just visual.
The name comes from non-existing science "Burmatography" used in "Neznaika" kids books
| |
| CapitalizeFirstChar |
Capitalizes first character of string
| |
| Default |
Defaults string if it is null or whitespace
| |
| DisplayNameWithExpandedGenericArgs |
Returns the the name of the type with expanded generic argument names.
This helper is useful for printing class names to logs/messages.
List'1[System.Object] -> List<Object>
| |
| EntryExeName |
Returns the name of entry point executable file optionaly with its path
| |
| EqualsIgnoreCase |
Helper function that performs case-insensitive comparison between strings using invariant comparison.
Either lhs and rhs can be null.
Use this in conjunction with GetHashCodeIgnoreCase
| |
| EqualsOrdIgnoreCase |
Helper function that performs case-insensitive comparison between strings using ordinal comparison.
Either lhs and rhs can be null.
Use this in conjunction with GetHashCodeOrdIgnoreCase
| |
| EqualsOrdSenseCase |
Helper function that performs case-insensitive comparison between strings using ordinal comparison.
Either lhs and rhs can be null.
Use this in conjunction with GetHashCodeOrdSenseCase
| |
| EqualsSenseCase |
Helper function that performs comparison between strings using invariant comparison.
Either lhs and rhs can be null.
Use this in conjunction with GetHashCodeSenseCase
| |
| EvaluateVars |
Evaluates variables in a context of optional variable resolver and macro runner
| |
| EvaluateVarsInConfigScope |
Evaluates variables in a context of optional configuration supplied as config object
| |
| EvaluateVarsInDictionaryScope |
Evaluates variables in a context of optional configuration supplied as dictionary which is converted to attributes
| |
| EvaluateVarsInXMLConfigScope |
Evaluates variables in a context of optional configuration supplied in XML format
| |
| FromMicrosecondsSinceUnixEpochStart(Int64) |
Gets UTC DateTime from number of microseconds since Unix epoch start (1970/1/1 0:0:0)
| |
| FromMicrosecondsSinceUnixEpochStart(UInt64) |
Gets UTC DateTime from number of microseconds since Unix epoch start (1970/1/1 0:0:0)
| |
| FromMillisecondsSinceUnixEpochStart(Int64) |
Gets UTC DateTime from number of milliseconds since Unix epoch start (1970/1/1 0:0:0)
| |
| FromMillisecondsSinceUnixEpochStart(UInt64) |
Gets UTC DateTime from number of milliseconds since Unix epoch start (1970/1/1 0:0:0)
| |
| FromSecondsSinceUnixEpochStart(Int64) |
Gets UTC DateTime from number of seconds since Unix epoch start (1970/1/1 0:0:0)
| |
| FromSecondsSinceUnixEpochStart(UInt64) |
Gets UTC DateTime from number of seconds since Unix epoch start (1970/1/1 0:0:0)
| |
| FromUTF8Bytes |
Decode string with standart UTF8 decoder
| |
| FullNameWithExpandedGenericArgs |
Returns the full name of the type optionally prefixed with verbatim id specifier '@'.
The generic arguments ar expanded into their full names i.e.
List'1[System.Object] -> System.Collections.Generic.List<System.Object>
| |
| GetHashCodeIgnoreCase |
Helper function that performs case-insensitive GetHashcode for string using invariant comparison.
Use this in conjunction with EqualsIgnoreCase
| |
| GetHashCodeOrdIgnoreCase |
Helper function that performs case-insensitive GetHashcode for string using ordinal comparison.
Use this in conjunction with EqualsOrdIgnoreCase
| |
| GetHashCodeOrdSenseCase |
Helper function that performs case-insensitive GetHashcode for string using ordinal comparison.
Use this in conjunction with EqualsOrdSenseCase
| |
| GetHashCodeSenseCase |
Helper function that performs GetHashcode for string using invariant comparison.
Use this in conjunction with EqualsSenseCase
| |
| IPStringToIPEndPoint | Obsolete.
Converts string of format "xx.xx.xx.xx:nnnn" into IPEndPoint.
DNS names are NOT supported
| |
| IsComponentDesignerHosted |
Determines if component is being used within designer
| |
| IsNotNullOrEmpty |
Helper function that calls !string.IsNullOrEmpty()
| |
| IsNotNullOrWhiteSpace |
Helper function that calls !string.IsNullOrWhiteSpace()
| |
| IsNullOrEmpty |
Helper function that calls string.IsNullOrEmpty()
| |
| IsNullOrWhiteSpace |
Helper function that calls string.IsNullOrWhiteSpace()
| |
| IsTrue | ||
| IsValidXMLName |
Returns true when supplied name can be used for XML node naming (node names, attribute names)
| |
| NonNull T |
Checks the value for null and throws exception if it is.
The method is useful for .ctor call chaining to preclude otherwise anonymous NullReferenceException
| |
| RoundToNextWeekDay |
Round date to next specific week day
| |
| RoundToWeekDay |
Round date to specific week day
| |
| RunAndCompleteProcess |
Runs specified process and waits for termination returning standard process output.
This is a blocking call
| |
| SplitLines |
Splits string into lines using Win or .nix line brakes
| |
| StripSimpleHtml |
Strip simple html from string
| |
| TakeFirstChars |
Takes first X chars from a string. If string is null returns null. If string does not have enough
the function returns what the string has
| |
| ToConfigAttributes |
Converts dictionary into configuration where every original node gets represented as an attribute of config's root
| |
| ToConfigSections |
Converts dictionary into configuration where every original node gets represented as a sub-section of config's root
| |
| ToDebugView |
Converts expression tree to simple textual form for debugging
| |
| ToDescription |
Returns MemberInfo described as short string
| |
| ToDumpString |
Convert a buffer to a printable string
| |
| ToGUID |
Generates GUID based on a string MD5 hash
| |
| ToIPEndPoint |
Resolve IP address by Name
| |
| ToJSONDataMap |
If there is error, converts its details to JSOnDataMap
| |
| ToMD5( Byte ) |
Returns a MD5 hash of a byte array
| |
| ToMD5(String) |
Returns a MD5 hash of a UTF8 string represented as byte[]
| |
| ToMD5String |
Returns a MD5 hash of a UTF8 string represented as hex string
| |
| ToMessageWithType |
Writes exception message with exception type
| |
| ToMicrosecondsSinceUnixEpochStart |
Gets number of microseconds since Unix epoch start (1970/1/1 0:0:0)
| |
| ToMillisecondsSinceUnixEpochStart |
Gets number of milliseconds since Unix epoch start (1970/1/1 0:0:0)
| |
| ToSecondsSinceUnixEpochStart |
Gets number of seconds since Unix epoch start (1970/1/1 0:0:0)
| |
| ToUTF8Bytes |
Encodes string with standart UTF8 encoder
| |
| Truncate |
Tuncate date to specific resolution
|
Fields
| Name | Description | |
|---|---|---|
| UNIX_EPOCH_START_DATE | ||
| WIN_UNIX_LINE_BRAKES |
See Also