| IGLib 1.7.2 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Static Public Member Functions | Public Attributes | Static Protected Member Functions | Static Protected Attributes | Properties | Static Private Attributes | List of all members
IG.Lib.Util Class Reference

General utilities. More...

## Static Public Member Functions
static bool | MutexCheckAbandoned (Mutex m)
| Check whether the specified mutex has been abandoned, and returns true if it has been (otherwise, false is returned). More...
static bool | MutexGlobalCheckAbandoned ()
| Check whether the global mutex (property MutexGlobal) has been abandoned, and returns true if it has been (otherwise, false is returned). More...
static void | SleepSeconds (double sleepTimeInSeconds)
| Suspends execution of the current thread for the specified time (in seconds). More...
static int | GetHashFunctionInt (object obj)
| Returns an integer hashRet function of the specified object. More...
static string | GetHashFunctionString (Object obj)
| Returns a string-valued hashRet function of the specified object. More...
static List< enumType > | GetEnumValues< enumType > ()
| Returns IEnumerable containing all values of the enumeration whose type is specified as type parameter. More...
static string | EnumValuesToString< enumType > ()
| Returns a stirng that contains information about the specified enumeration type. More...
static int | GetIndex (int[] tableDimensions, params int[] indices)
| Returns the index of the element in the onedimensional list that corresponds to the specified indices of the multidimensional table of specified dimensions. More...
static void | GetIndices (int[] tableDimensions, int oneDimensionalIndex, ref int[] tableIndices)
| Calculates and stores the multidimensional indices of an element of the multidimensional table of the specified dimensions, which correspond to the specified onedimensional index (index within 1D table containing all elements of the multidimensional table, ordered according to the normal convention - earlier indices run slower). More...
static int | GetIndex (List< int > tableDimensions, params int[] indices)
| Returns the index of the element in an onedimensional list that corresponds to the specified indices of the multidimensional table of specified dimensions. More...
static void | GetIndices (List< int > tableDimensions, int oneDimensionalIndex, ref int[] tableIndices)
| Calculates and stores the multidimensional indices of an element of the multidimensional table of the specified dimensions, which correspond to the specified onedimensional index (index in the 1D table containing all elements of the multidimensional table, ordered according to the normal convention - earlier indices run slower). More...
static void | ResizeList< T > (ref List< T > list, int count, T defaultElement, bool reduceCapacity)
| Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. More...
static void | ResizeList< T > (ref List< T > list, int count, T defaultElement)
| Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If new size is smaller than the original size of the list then its capacity is not reduced. More...
static void | ResizeListRefType< T > (ref List< T > list, int count, bool reduceCapacity)
| Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If list must be enlarged then null elements are inserted to new places. List must contain elements of some reference type! More...
static void | ResizeListRefType< T > (ref List< T > list, int count)
| Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If list must be enlarged then null elements are inserted to new places. List must contain elements of some reference type! More...
static void | CopyList< T > (List< T > original, ref List< T > target)
| Copies all elements of the specified list to a target list. After operation, target list contains all elements of the source list (only references are copied for objects) in the same order. If the original list is null then target list can either be allocated (if it was allocated before the call) or not. Target list is allocated or re-allocated as necessary. More...
static void | CopyList< T > (List< T > original, ref T[] target)
| Copies all elements of the specified list to a target table. After operation, target table contains all elements of the source list (only references are copied for objects) in the same order. If the original list is null then target table will also become null. Target table is allocated or re-allocated as necessary. More...
static bool | IsListSorted< T > (List< T > list, IComparer< T > comparer)
| Checks whether the specified list is sorted according to the specified comparer, and returns true if the list is sorted and false if it is not. More...
static void | InsertSortedList< T > (List< T > sortedList, T insertedElement, IComparer< T > comparer)
| Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains sorted. More...
static void | InsertSortedListUnique< T > (List< T > sortedList, T insertedElement, IComparer< T > comparer)
| Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains and no duplicates are inserted. More...
static bool | IsListSorted< T > (List< T > list, Comparison< T > comparison)
| Checks whether the specified list is sorted according to the specified comparison function, and returns true if the list is sorted and false if it is not. More...
static int | BinarySearchSortedListFromTo< T > (List< T > sortedList, T searchedElement, int from, int to, Comparison< T > comparison)
| Searches a sorted list in the specified range for the specified element, and returns its index if the element is found, or a negative complement of the index before the first element that is greater than the specified element (or binary complement of one greater than the last index if no element is greater). More...
static int | BinarySearchSortedList< T > (List< T > sortedList, T searchedElement, Comparison< T > comparison)
| Searches a sorted list for the specified element, and returns its index if the element is found, or a negative complement of the index before the first element that is greater than the specified element (or binsry complement of number of elements if no element is greater). More...
static void | InsertSortedList< T > (List< T > sortedList, T insertedElement, Comparison< T > comparison)
| Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains sorted. More...
static void | InsertSortedListUnique< T > (List< T > sortedList, T insertedElement, Comparison< T > comparison)
| Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains and no duplicates are inserted. More...
static string | ToString< T > (IList< T > elementList)
| Creates and returns a stirng representation of a list of items. More...
static string | ToString< T > (IList< T > elementList, bool newLines, int numIndent=0)
| Creates and returns a stirng representation of a list of items. More...
static bool | AreEqual< T > (IEnumerable< T > a, IEnumerable< T > b)
| Returns true if the specified enumerables (collections) are equal, false otherwise. More...
static bool | AreEqual< T > (IList< T > a, IList< T > b)
| Returns true if the specified collections are equal, false otherwise. More...
static T[] | Concatenate< T > (params IList< T >[] arrays)
| Concatenates an arbitrary number of arrays or lists of the specified type, and returns the result. More...
static int | SizeOf< T > (T?val)
| Returns size of a value of some specific value type, in bytes. More...
static int | SizeOf< T > (T val)
| Returns size of a value of some specific value type, in bytes. More...
static int | SizeOf (Type t)
| Returns size of a value of some specific value type, in bytes. More...
static int | SizeOf (bool val)
| Returns size of a value of type bool, in bytes. More...
static int | SizeOf (char val)
| Returns size of a value of type char, in bytes. More...
static int | SizeOf (sbyte val)
| Returns size of a value of type sbyte, in bytes. More...
static int | SizeOf (byte val)
| Returns size of a value of type byte, in bytes. More...
static int | SizeOf (short val)
| Returns size of a value of type short, in bytes. More...
static int | SizeOf (ushort val)
| Returns size of a value of type ushort, in bytes. More...
static int | SizeOf (int val)
| Returns size of a value of type int, in bytes. More...
static int | SizeOf (uint val)
| Returns size of a value of type uint, in bytes. More...
static int | SizeOf (long val)
| Returns size of a value of type long, in bytes. More...
static int | SizeOf (ulong val)
| Returns size of a value of type ulong, in bytes. More...
static int | SizeOf (float val)
| Returns size of a value of type float, in bytes. More...
static int | SizeOf (double val)
| Returns size of a value of type double, in bytes. More...
static void | ToByteArray (bool val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (bool val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (char val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (char val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (byte val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (byte val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (sbyte val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (sbyte val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (Int16 val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (Int16 val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (UInt16 val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (UInt16 val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (Int32 val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (Int32 val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (UInt32 val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (UInt32 val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (Int64 val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (Int64 val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (UInt64 val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (UInt64 val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (float val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (float val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | ToByteArray (double val, ref byte[] bytes)
| Converts a value to byte array. More...
static void | ToByteArray (double val, byte[] bytes, int startIndex=0)
| Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position. More...
static void | FromByteArray (byte[] bytes, out bool val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out bool val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out char val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out char val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out byte val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out byte val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out Int16 val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out Int16 val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out UInt16 val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out UInt16 val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out Int32 val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out Int32 val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out UInt32 val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out UInt32 val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out Int64 val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out Int64 val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out UInt64 val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out UInt64 val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out float val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out float val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static void | FromByteArray (byte[] bytes, out double val, bool preciseLength, int startIndex=0)
| Extracts the value stored in a byte array in big-endian order. More...
static void | FromByteArray (byte[] bytes, out double val, int startIndex=0)
| Extracts the value stored in a byte array in the big-endian order. More...
static byte[] | FromHexString (string hex)
| Returns a byte array that is represented by a hexadecimal string. More...
static int | HexCharToInt (char hex)
| Returns value of the specified hexadecimal character (e.g. 9 for '9', 10 for 'a' or 'A', 15 for 'f' or 'F'). More...
static string | ToHexString (byte[] bytes, string separator=null)
| Returns a hexadecimal string representation of the specified byte array using lower case letters for digits above 9. More...
static string | ToHexString (byte[] bytes, bool upperCase, string separator=null)
| Returns a hexadecimal string representation of the specified byte array. More...
static bool | AreHexStringsEqual (string hexString1, string hexString2)
| Returns true if the two specified hexadecimal strings represent the same sequence of bytes (or the same number), and false otherwise. More...
static string | CollectionToString (System.Collections.ICollection list, bool addNewlines, int numIndent)
| Returns a string representing the specified collection of objects. Each object is printeed by its ToString() method. Works on all collections, including lists and arrays. More...
static string | CollectionToString (System.Collections.ICollection list)
| Returns a string representing the specified collection of objects. Each object is printeed by its ToString() method. A newline and two spaces are added before each element printed. Works on all collections, including lists and arrays. More...
static string | CollectionToStringLong (System.Collections.ICollection collection, bool addNewlines, int numIndent)
| Returns a string representing the specified list in long form. Count property (i.e. number of elements in collection) is also printed. Works on all collections, including lists and arrays. More...
static string | CollectionToStringLong (System.Collections.ICollection collection)
| Returns a string representing the specified list in long form. Count property (i.e. number of elements in collection) is also printed. Works on all collections, including lists and arrays. A newline and two spaces are added before each element printed. More...
static string | ListToString< T > (List< T > list, bool addNewlines, int numIndent)
| Returns a string representing the specified generic list in short form (without count and capacity). More...
static string | ListToString< T > (List< T > list)
| Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. A newline and two spaces are added before each element printed. More...
static string | ListToStringLong< T > (List< T > list, bool addNewlines, int numIndent)
| Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. More...
static string | ListToStringLong< T > (List< T > list)
| Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. A newline and two spaces are added before each element printed. More...
static string | ObjectToString< ObjectType > (ObjectType obj)
| Converts obect of the specified type to its string representation, where numbers are converted in ivariant culture (ignoring any localization settings). More...
static string | ObjectToString< ObjectType > (ObjectType obj, System.Globalization.CultureInfo cultureInfo)
| Converts obect of the specified type to its string representation, where numbers are converted in ivariant culture (ignoring any localization settings). More...
static bool | IsNumeric< ObjectType > (ObjectType obj)
| Returns a flag indicating whether the specified object is of numeric type (such as int, float, double, etc.). More...
static void | TestToString ()
| Test conversion to strings with invariant culture info. More...
static bool | TryParse< ReturnType > (string strValue, ref ReturnType parsedValue)
| Tries to parse a string representation of an object of the specified type and return it through output argument. Invariant culture is used in parsing. More...
static ReturnType | Parse< ReturnType > (string strValue)
| Converts a string to the object of the specified type and returns the entity, by using the invariant culture. More...
static object | Parse (string strValue, Type propertyType)
| Converts a string to the entity of the specified type and returns that entity, by using invariant culture. More...
static bool | TryParse< ReturnType > (string strValue, ref ReturnType parsedValue, System.Globalization.CultureInfo cultureInfo)
| Tries to parse a string representation of an object of the specified type and return it through output argument. More...
static ReturnType | Parse< ReturnType > (string strValue, System.Globalization.CultureInfo cultureInfo)
| Converts a string to the object of the specified type and returns the entity, by using the specified culture info. More...
static object | Parse (string strValue, Type propertyType, System.Globalization.CultureInfo cultureInfo)
| Converts a string to the entity of the specified type and returns that entity. More...
static bool | TryParseBoolean (string str, ref bool parsedValue)
| Tries to parse a string representation of a boolean. More...
static bool | ParseBoolean (string str)
| Converts the specified string to a boolean value, if possible, and returns it. If conversion is not possible then exception is thrown. Recognized representations of true: "true", "1", "yes", "y" (case insensitive). Recognized representations of false: "false", "0", "no", "n" (case insensitive). More...
static bool | TryParseThreadPriority (string str, ref ThreadPriority parsedValue)
| Tries to parse a string representation of a ThreadPriority enum. More...
static ThreadPriority | ParseThreadPriority (string str)
| Converts the specified string to a ThreadPriority enum value, if possible, and returns it. If conversion is not possible then exception is thrown. More...
static string | XmlToString (string xmlString, string indentCahrs=" ", string newlineChars=null)
| Returns a reformatted XML string, eventually in a more human readable form. More...
static string | XmlToString (XmlDocument doc, string indentCahrs=" ", string newlineChars=null)
| Converts the specified XML document to string, eventually with human readable indentation and newlines added. The stirng representation is returned. More...
static void | ExampleList ()

## Public Attributes
const string | MutexGlobalName = "Global\\IG.Lib.Utils.MutexGlobal.R2D2_by_Igor_Gresovnik"
| Name of the global mutex. More...
const string | NullRepresentationString = "null"
| Standard string representation of null values of objects (often used when overriding object.ToString method). More...
const string | IGLibUrl = "http://www2.arnes.si/~ljc3m2/igor/iglib/"
const string | IGLibCodeDocumentationUrl = "http://www2.arnes.si/~fgreso/code_documentation/generated/iglib/html/index.html"
const string | IGLibAuthor = "Igor Grešovnik"

## Static Protected Member Functions
static bool | IsNumericOld (object expression)
| Returns true if the specified expression or object is of numeric type (such as int, float, double, etc.), and false otherwise. More...

## Static Protected Attributes
static volatile Mutex | _mutexGlobal

## Properties
static object | LockGlobal`[get]`
| Global, process-level locking object. More...
static Mutex | MutexGlobal`[get]`
| Mutex for system-wide exclusive locks. More...
static int | OutputLevel`[get, set]`
| Serves as default output level for new objects of many classes that include the output level property (usually named "OutputLevel"). Such a property defines how much information about operation of the object is ouput to the console. More...

## Static Private Attributes
static object | _lockGlobal = new object()
static volatile int | _outputLevel = 0
static volatile int | _maxLengthIntToString
static readonly ConcurrentDictionary< Type, int > | _cache = new ConcurrentDictionary<Type, int>()
static byte[] | _auxBytes = null

## Detailed Description

General utilities.

$A Igor Apr10 Jun15;

## Member Function Documentation

static bool IG.Lib.Util.MutexCheckAbandoned | ( | Mutex | m | ) |
| inline static

Check whether the specified mutex has been abandoned, and returns true if it has been (otherwise, false is returned).

After the call, mutex is no longer in abandoned state (WaitOne() will not throw an exception) if it has been before the call.

Call does not block.

Parameters

  m | Mutex that is checked, must not be null.

Returns
  true if mutex has been abandoned, false otherwise.

Referenced by IG.Num.OptFileManager.LockFileMutexCheckAbandoned().

static bool IG.Lib.Util.MutexGlobalCheckAbandoned | ( |  | ) |
| inline static

Check whether the global mutex (property MutexGlobal) has been abandoned, and returns true if it has been (otherwise, false is returned).

After the call, mutex is no longer in abandoned state (WaitOne() will not throw an exception) if it has been before the call.

Call does not block.

Returns
  true if mutex has been abandoned, false otherwise.

static void IG.Lib.Util.SleepSeconds | ( | double | sleepTimeInSeconds | ) |
| inline static

Suspends execution of the current thread for the specified time (in seconds).

Parameters

  sleepTimeInSeconds | Sleeping time in seconds. If less than 0 then thread sleeps indefinitely.

Referenced by IG.Forms.InputParametersControl.dGridInputParam_CellValueChanged(), IG.Forms.ScalarFunctionEvaluatorControl.dGridInputParam_CellValueChanged(), IG.Forms.InpuOrOutputtDataDefinitionControl.dGridInputParam_CellValueChanged(), IG.Lib.StopWatch1.Example(), and IG.Gr3d.Graph3dManipulator.UpdateTextFields().

static int IG.Lib.Util.GetHashFunctionInt | ( | object | obj | ) |
| inline static

Returns an integer hashRet function of the specified object.

Returned integer is always positive.

This hashRet function is bound to the object.ToString method of the specified object, which means that it returns the same value for any two objects that have the same string representation.

Parameters

  obj | Object whose hashRet function is returned.

This hashRet function is calculated in such a way that object.ToString() is called first on obj in order to obtain object's string representation (or, if the object is null, the Util.NullRepresentationString is taken), and then the string.GetHashCode is called on the obtained string and its value returned.

References IG.Lib.Util.NullRepresentationString.

Referenced by IG.Num.MatrixBase.GetHashFunctionInt(), and IG.Num.VectorBase.GetHashFunctionInt().

static string IG.Lib.Util.GetHashFunctionString | ( | Object | obj | ) |
| inline static

Returns a string-valued hashRet function of the specified object.

This hashRet function is bound to the object.ToString method of the specified object, which means that it returns the same value for any two objects that have the same string representation.

Parameters

  obj | Object whose string-valued hashRet function is returned.

This hashRet function is calculated in such a way that object.ToString() is called first on obj in order to obtain object's string representation (or, if the object is null, the Util.NullRepresentationString is taken), and then the string.GetHashCode is called on the obtained string and its value returned.

See also
  Util

Referenced by IG.Num.MatrixBase.GetHashFunctionString(), and IG.Num.VectorBase.GetHashFunctionString().

static List<enumType> IG.Lib.Util.GetEnumValues< enumType > | ( |  | ) |
| inline static

Returns IEnumerable containing all values of the enumeration whose type is specified as type parameter.

Template Parameters

  enumType | Type of enumeration whose all possible values are returned.

static string IG.Lib.Util.EnumValuesToString< enumType > | ( |  | ) |
| inline static

Returns a stirng that contains information about the specified enumeration type.

Enumeration name and its symbolic values, together with the corresponding integer values, are contained in the returned string.

Warning: thic function is slow because a number of exceptions are caught until the right integer type is picked, because conversion is performed through boxing, therefore exact match must be obtained.

Template Parameters

  enumType | Enumeration type whose information in string form is returned.

Type Constraints

  enumType | : | struct |

static int IG.Lib.Util.GetIndex | ( | int[] | tableDimensions,
|  | params int[] | indices
| ) |  |
| inline static

Returns the index of the element in the onedimensional list that corresponds to the specified indices of the multidimensional table of specified dimensions.

Parameters

  indices | Indices of the element in the multidimensional table of training results.
  tableDimensions | Dimensions of the multidimensional table.

Returns
  One dimensional index that corresponds to the specified multidimensional indices of the element of the multidimensional table.

Referenced by IG.Num.NeuralTrainingTable.GetIndex().

static void IG.Lib.Util.GetIndices | ( | int[] | tableDimensions,
|  | int | oneDimensionalIndex,
|  | ref int[] | tableIndices
| ) |  |
| inline static

Calculates and stores the multidimensional indices of an element of the multidimensional table of the specified dimensions, which correspond to the specified onedimensional index (index within 1D table containing all elements of the multidimensional table, ordered according to the normal convention - earlier indices run slower).

Parameters

  tableDimensions | Dimensions of the multidimensional table.
  oneDimensionalIndex | One dimensional index that defines the position of the element in the list of elements.
  tableIndices | Variable where multidimensional indices of the element are stored.

Referenced by IG.Num.NeuralTrainingTable.GetIndices().

static int IG.Lib.Util.GetIndex | ( | List< int > | tableDimensions,
|  | params int[] | indices
| ) |  |
| inline static

Returns the index of the element in an onedimensional list that corresponds to the specified indices of the multidimensional table of specified dimensions.

Parameters

  indices | Indices of the element in the multidimensional table of training results.
  tableDimensions | Dimensions of the multidimensional table.

Returns
  One dimensional index that corresponds to the specified multidimensional indices of the element of the multidimensional table.

static void IG.Lib.Util.GetIndices | ( | List< int > | tableDimensions,
|  | int | oneDimensionalIndex,
|  | ref int[] | tableIndices
| ) |  |
| inline static

Calculates and stores the multidimensional indices of an element of the multidimensional table of the specified dimensions, which correspond to the specified onedimensional index (index in the 1D table containing all elements of the multidimensional table, ordered according to the normal convention - earlier indices run slower).

Parameters

  tableDimensions | Dimensions of the multidimensional table.
  oneDimensionalIndex | One dimensional index that defines the position of the element in the list of elements.
  tableIndices | Variable where multidimensional indices of the element are stored.

static void IG.Lib.Util.ResizeList< T > | ( | ref List< T > | list,
|  | int | count,
|  | T | defaultElement,
|  | bool | reduceCapacity
| ) |  |
| inline static

Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation.

Template Parameters

  T | Type of the list element.

Parameters

  list | List to be allocated.
  count | Number of elements list will contain after operation.
  defaultElement | Elements to be added to the list if there are currently too few elements.
  reduceCapacity | If true then capacity is reduced if the current list's capacity exceeds the specified number of elements.

$A Igor Apr10;

static void IG.Lib.Util.ResizeList< T > | ( | ref List< T > | list,
|  | int | count,
|  | T | defaultElement
| ) |  |
| inline static

Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If new size is smaller than the original size of the list then its capacity is not reduced.

Template Parameters

  T | Type of the list element.

Parameters

  list | List to be allocated.
  count | Number of elements list will contain after operation.
  defaultElement | Elements to be added to the list if there are currently too few elements.

$A Igor Apr10;

static void IG.Lib.Util.ResizeListRefType< T > | ( | ref List< T > | list,
|  | int | count,
|  | bool | reduceCapacity
| ) |  |
| inline static

Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If list must be enlarged then null elements are inserted to new places. List must contain elements of some reference type!

Template Parameters

  T | Type of the list element, must be a reference type.

Parameters

  list | List to be allocated.
  count | Number of elements list will contain after operation.
  reduceCapacity | If true then capacity is reduced if the current list's capacity exceeds the specified number of elements.

$A Igor Apr10;

Type Constraints

  T | : | class |

static void IG.Lib.Util.ResizeListRefType< T > | ( | ref List< T > | list,
|  | int | count
| ) |  |
| inline static

Allocates or re-allocates (resizes) the specified list in such a way that it contains the specified number of elements after operation. If list must be enlarged then null elements are inserted to new places. List must contain elements of some reference type!

Template Parameters

  T | Type of the list element, must be a reference type.

Parameters

  list | List to be allocated.
  count | Number of elements list will contain after operation.

$A Igor Apr10;

Type Constraints

  T | : | class |

static void IG.Lib.Util.CopyList< T > | ( | List< T > | original,
|  | ref List< T > | target
| ) |  |
| inline static

Copies all elements of the specified list to a target list. After operation, target list contains all elements of the source list (only references are copied for objects) in the same order. If the original list is null then target list can either be allocated (if it was allocated before the call) or not. Target list is allocated or re-allocated as necessary.

Template Parameters

  T | Type of elements contained in the list.

Parameters

  original | Original list.
  target | List that elements of the original list are copied to.

static void IG.Lib.Util.CopyList< T > | ( | List< T > | original,
|  | ref T[] | target
| ) |  |
| inline static

Copies all elements of the specified list to a target table. After operation, target table contains all elements of the source list (only references are copied for objects) in the same order. If the original list is null then target table will also become null. Target table is allocated or re-allocated as necessary.

Template Parameters

  T | Type of elements contained in the list.

Parameters

  original | Original list.
  target | Table that elements of the original list are copied to.

static bool IG.Lib.Util.IsListSorted< T > | ( | List< T > | list,
|  | IComparer< T > | comparer
| ) |  |
| inline static

Checks whether the specified list is sorted according to the specified comparer, and returns true if the list is sorted and false if it is not.

Template Parameters

  T | Type of elements of the list.

Parameters

  list | List to be checked for sorting.
  comparer | Comparer according to which sorting is verified.

Returns
  True if the specified list is sorted, false if not.

Exceptions

  ArgumentNullException | If list or comparer is null.

static void IG.Lib.Util.InsertSortedList< T > | ( | List< T > | sortedList,
|  | T | insertedElement,
|  | IComparer< T > | comparer
| ) |  |
| inline static

Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains sorted.

Duplicate elements are allowed.

Template Parameters

  T | Type of elements of the list.

Parameters

  sortedList | Sorted list.
  insertedElement | Element to be inserted.
  comparer | Comparer according to which the list is sorted.

Exceptions

  ArgumentNullException | If list or comparer is null.

static void IG.Lib.Util.InsertSortedListUnique< T > | ( | List< T > | sortedList,
|  | T | insertedElement,
|  | IComparer< T > | comparer
| ) |  |
| inline static

Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains and no duplicates are inserted.

If the list already contains the element that is equal (in the sense of comparer) than the inserted element then this method has no effect.

Template Parameters

  T | Type of elements of the list.

Parameters

  sortedList | Sorted list.
  insertedElement | Element to be inserted.
  comparer | Comparer according to which the list is sorted.

Exceptions

  ArgumentNullException | If list or comparer is null.

static bool IG.Lib.Util.IsListSorted< T > | ( | List< T > | list,
|  | Comparison< T > | comparison
| ) |  |
| inline static

Checks whether the specified list is sorted according to the specified comparison function, and returns true if the list is sorted and false if it is not.

Template Parameters

  T | Type of elements of the list.

Parameters

  list | List to be checked for sorting.
  comparison | Comparison method (delegate) according to which sorting is verified.

Returns
  True if the specified list is sorted, false if not.

Exceptions

  ArgumentNullException | If list or comparer is null.

static int IG.Lib.Util.BinarySearchSortedListFromTo< T > | ( | List< T > | sortedList,
|  | T | searchedElement,
|  | int | from,
|  | int | to,
|  | Comparison< T > | comparison
| ) |  |
| inline static

Searches a sorted list in the specified range for the specified element, and returns its index if the element is found, or a negative complement of the index before the first element that is greater than the specified element (or binary complement of one greater than the last index if no element is greater).

Template Parameters

  T | Type of list elements.

Parameters

  sortedList | List that is searched for the element. List must be sorted according to the specified comparison function.
  searchedElement | Element that is searched for.
  from | Index of the first element in the searched range.
  to | Index of the last element in the searched range.
  comparison | Comparison function (delegate) according to which the list is sorted.

Returns
  Index of the searched element in the list, if there exist an element (within the search range) that is equal to the search element according to the comparison delegate, or a binary complement of the negative index where the element should be inserted in order not tho spoil sorting.

Exceptions

  ArgumentNullException | When list or comparison delegate is null.

static int IG.Lib.Util.BinarySearchSortedList< T > | ( | List< T > | sortedList,
|  | T | searchedElement,
|  | Comparison< T > | comparison
| ) |  |
| inline static

Searches a sorted list for the specified element, and returns its index if the element is found, or a negative complement of the index before the first element that is greater than the specified element (or binsry complement of number of elements if no element is greater).

Template Parameters

  T | Type of list elements.

Parameters

  sortedList | List that is searched for the element. List must be sorted according to the specified comparison function.
  searchedElement | Element that is searched for.
  comparison | Comparison function (delegate) according to which the list is sorted.

Returns
  Index of the searched element in the list, if there exist an element (within the search range) that is equal to the search element according to the comparison delegate, or a binary complement of the negative index where the element should be inserted in order not tho spoil sorting.

Exceptions

  ArgumentNullException | When list or comparison delegate is null.

static void IG.Lib.Util.InsertSortedList< T > | ( | List< T > | sortedList,
|  | T | insertedElement,
|  | Comparison< T > | comparison
| ) |  |
| inline static

Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains sorted.

Duplicate elements are allowed.

Template Parameters

  T | Type of elements of the list.

Parameters

  sortedList | Sorted list.
  insertedElement | Element to be inserted.
  comparison | Comparison function (delegate) according to which the list is sorted.

Exceptions

  ArgumentNullException | If list or comparer is null.

static void IG.Lib.Util.InsertSortedListUnique< T > | ( | List< T > | sortedList,
|  | T | insertedElement,
|  | Comparison< T > | comparison
| ) |  |
| inline static

Inserts the specified element to the appropriate position in a sorted list, in such a way that the list remains and no duplicates are inserted.

If the list already contains the element that is equal (in the sense of comparer) than the inserted element then this method has no effect.

Template Parameters

  T | Type of elements of the list.

Parameters

  sortedList | Sorted list.
  insertedElement | Element to be inserted.
  comparison | Comparison function (delegate) according to which the list is sorted.

Exceptions

  ArgumentNullException | If list or comparer is null.

static string IG.Lib.Util.ToString< T > | ( | IList< T > | elementList | ) |
| inline static

Creates and returns a stirng representation of a list of items.

Each item in the list is represented by calling its own ToString() method.

Template Parameters

  T | Type of elements of the listt.

Parameters

  elementList | List whose string representation is returned.

static string IG.Lib.Util.ToString< T > | ( | IList< T > | elementList,
|  | bool | newLines,
|  | int | numIndent = `0`
| ) |  |
| inline static

Creates and returns a stirng representation of a list of items.

Each item in the list is represented by calling its own ToString() method.

Template Parameters

  T | Type of elements of the listt.

Parameters

  elementList | List whose string representation is returned.
  newLines | If true then representation of each element is positioned in its ownl line.
  numIndent | Indentation. If greater than 0 then this number of spaces is inserted before each line of the returned string (including in the beginning of the returned string, which also applies if newLines is false).

Returns

static bool IG.Lib.Util.AreEqual< T > | ( | IEnumerable< T > | a,
|  | IEnumerable< T > | b
| ) |  |
| inline static

Returns true if the specified enumerables (collections) are equal, false otherwise.

Enumerables are considered equal if they are both null, or they are of the same size and all elements are equal.

Template Parameters

  T | Type of elements of the enumerables.

Parameters

  a | First enumerable to be compared.
  b | Second enumerable to be compared.

Returns
  True if the two enumerables are of equal lengths and have equal adjacent elements or are both null; false otherwise.

Type Constraints

  T | : | IComparable<T> |

static bool IG.Lib.Util.AreEqual< T > | ( | IList< T > | a,
|  | IList< T > | b
| ) |  |
| inline static

Returns true if the specified collections are equal, false otherwise.

Collection are considered equal if they are both null, or they are of the same size and all elements are equal.

There is also a method for comparing variables of IEnumerable{T} interface which can be used in all places where this method is used. A special method for collections was created for efficiency reasons, because the IList{T} interface implements the Count property, thus collections of unequal sizes can be immediately detected as unequal by comparing their size, and one does not need to iterate over elements.

Template Parameters

  T | Type of elements of the collections.

Parameters

  a | First collection to be compared.
  b | Second collection to be compared.

Returns
  True if the two collection are of equal lengths and have equal adjacent elements or are both null; false otherwise.

Type Constraints

  T | : | IComparable<T> |

static T [] IG.Lib.Util.Concatenate< T > | ( | params IList< T >[] | arrays | ) |
| inline static

Concatenates an arbitrary number of arrays or lists of the specified type, and returns the result.

Template Parameters

  T | Type of array elements.

Parameters

  arrays | An arbitrary-length list of array or list parameters to be concatenated.

Returns
  An array that contains, in order of appearance of the listed list/array parameters, all elements of those lists/arrays.

static int IG.Lib.Util.SizeOf< T > | ( | T? | val | ) |
| inline static

Returns size of a value of some specific value type, in bytes.

See also: http://stackoverflow.com/questions/16519200/size-of-struct-with-generic-type-fields

Parameters

  val | Value whose size is returned.

Type Constraints

  T | : | struct |

static int IG.Lib.Util.SizeOf< T > | ( | T | val | ) |
| inline static

Returns size of a value of some specific value type, in bytes.

See also: http://stackoverflow.com/questions/16519200/size-of-struct-with-generic-type-fields

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | Type | t | ) |
| inline static

Returns size of a value of some specific value type, in bytes.

See also: http://stackoverflow.com/questions/16519200/size-of-struct-with-generic-type-fields

Parameters

  t | Type of the value whose size is to be returned.

static int IG.Lib.Util.SizeOf | ( | bool | val | ) |
| inline static

Returns size of a value of type bool, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | char | val | ) |
| inline static

Returns size of a value of type char, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | sbyte | val | ) |
| inline static

Returns size of a value of type sbyte, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | byte | val | ) |
| inline static

Returns size of a value of type byte, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | short | val | ) |
| inline static

Returns size of a value of type short, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | ushort | val | ) |
| inline static

Returns size of a value of type ushort, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | int | val | ) |
| inline static

Returns size of a value of type int, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | uint | val | ) |
| inline static

Returns size of a value of type uint, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | long | val | ) |
| inline static

Returns size of a value of type long, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | ulong | val | ) |
| inline static

Returns size of a value of type ulong, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | float | val | ) |
| inline static

Returns size of a value of type float, in bytes.

Parameters

  val | Value whose size is returned.

static int IG.Lib.Util.SizeOf | ( | double | val | ) |
| inline static

Returns size of a value of type double, in bytes.

Parameters

  val | Value whose size is returned.

static void IG.Lib.Util.ToByteArray | ( | bool | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

Referenced by IG.Crypto.CryptoManager.AppCheckSum(), IG.Crypto.CryptoManager.AppConvert(), and IG.Script.ScriptAppBase.CryptoFunctionConvert_OLD_TO_DELETE().

static void IG.Lib.Util.ToByteArray | ( | bool | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | char | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | char | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | byte | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | byte | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | sbyte | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | sbyte | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | Int16 | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | Int16 | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | UInt16 | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | UInt16 | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | Int32 | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | Int32 | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | UInt32 | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | UInt32 | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | Int64 | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | Int64 | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | UInt64 | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | UInt64 | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | float | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | float | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.ToByteArray | ( | double | val,
|  | ref byte[] | bytes
| ) |  |
| inline static

Converts a value to byte array.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored. Allocated/reallocated if null or the current size does not precisely match the required size.

static void IG.Lib.Util.ToByteArray | ( | double | val,
|  | byte[] | bytes,
|  | int | startIndex = `0`
| ) |  |
| inline static

Converts a value to sequence of bytes and stores these bytes int the specified byte array at the specified position.

Bytes are stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given values produce the same byte arrays on all machines, regardless of endianness.

Parameters

  val | Value to be converted to byte array.
  bytes | Byte array where converted vlaue is stored.
  startIndex | Index where bytes are stored in the provided byte array.

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out bool | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out bool | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out char | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out char | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out byte | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out byte | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out Int16 | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out Int16 | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out UInt16 | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out UInt16 | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out Int32 | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out Int32 | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out UInt32 | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out UInt32 | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out Int64 | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out Int64 | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out UInt64 | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out UInt64 | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out float | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out float | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out double | val,
|  | bool | preciseLength,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.
  val | Variable where the extracted value is stored.
  preciseLength | If true then the bytes array must have precisely the right length to store the value at the specified index (startIndex ), otherwise the array can also be larger.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static void IG.Lib.Util.FromByteArray | ( | byte[] | bytes,
|  | out double | val,
|  | int | startIndex = `0`
| ) |  |
| inline static

Extracts the value stored in a byte array in the big-endian order.

Bytes must be stored in big-endian order ("network byte order") where most significant byte comes first. This is compatible with the Util.ToHexString(byte[], string) method and also guarantees that given bytes produce the same value on all machines, regardless of endianness.

Parameters

  bytes | Bytes array where value to be extracted is stored.

Length of the byte array can be larger than the smallest possible (with respect to startIndex and value size). If precise length is required, use the method with 2 arguments when starting index is 0, or with 4 arguments otherwise.

Parameters

  val | Variable where the extracted value is stored.
  startIndex | Index of the byte array where the stored value begins (this allows to store other values).

static byte [] IG.Lib.Util.FromHexString | ( | string | hex | ) |
| inline static

Returns a byte array that is represented by a hexadecimal string.

Parameters

  hex |

Returns

Referenced by IG.Crypto.CryptoManager.AppCheckSum(), IG.Crypto.CryptoManager.AppConvert(), IG.Crypto.CryptoManager.AppEncryptSymmetricAll(), IG.Script.ScriptAppBase.CryptoFunctionConvert_OLD_TO_DELETE(), IG.Script.ScriptAppBase.CryptoFunctionTimeKeyGeneration_OLD_TO_DELETE_LATER(), IG.Crypto.CryptoManager.ParseCommandlineParameters(), and IG.Lib.UtilConsole.ReadPwd().

static int IG.Lib.Util.HexCharToInt | ( | char | hex | ) |
| inline static

Returns value of the specified hexadecimal character (e.g. 9 for '9', 10 for 'a' or 'A', 15 for 'f' or 'F').

Parameters

  hex | Hexadecimal character whose integer value is returned.

Returns

static string IG.Lib.Util.ToHexString | ( | byte[] | bytes,
|  | string | separator = `null`
| ) |  |
| inline static

Returns a hexadecimal string representation of the specified byte array using lower case letters for digits above 9.

Parameters

  bytes | Array of bytes whose hexadecial representation is to be returned.
  separator | If not null or empty string then this string is inserted between hexadecimal digits.

If specified then it must be a single character string, and may not be a digit or a letter.

Referenced by IG.Crypto.CryptoManager.AppConvert(), IG.Crypto.CryptoManager.AppEncryptSymmetricAll(), IG.Crypto.CryptoManager.AppKeyGenerationAll(), IG.Script.ScriptAppBase.CryptoFunctionConvert_OLD_TO_DELETE(), IG.Crypto.UtilCrypto.GetAsymmetricalgorithmHash(), IG.Crypto.UtilCrypto.GetHashHex(), IG.Crypto.UtilCrypto.GetStringHashHex(), and IG.Crypto.UtilCrypto.GetStringSaltedHash().

static string IG.Lib.Util.ToHexString | ( | byte[] | bytes,
|  | bool | upperCase,
|  | string | separator = `null`
| ) |  |
| inline static

Returns a hexadecimal string representation of the specified byte array.

Parameters

  bytes | Array of bytes whose hexadecial representation is to be returned.
  upperCase | Whether digits greater than 9 should be represented by upper case letters (default is false).
  separator | If not null or empty string then this string is inserted between hexadecimal digits.

If specified then it must be a single character string, and may not be a digit or a letter.

static bool IG.Lib.Util.AreHexStringsEqual | ( | string | hexString1,
|  | string | hexString2
| ) |  |
| inline static

Returns true if the two specified hexadecimal strings represent the same sequence of bytes (or the same number), and false otherwise.

If any string is null or its length is 0 then false is returned.

Parameters

  hexString1 | The first hexadecimal sequence to be compared.
  hexString2 | The second hexadecimal sequence to be compared.

Referenced by IG.Crypto.UtilCrypto.CheckFileHashHex(), IG.Crypto.UtilCrypto.CheckFileHashSupportedTypesHex(), IG.Crypto.UtilCrypto.CheckHashHex(), IG.Crypto.UtilCrypto.CheckHashSupportedTypesHex(), IG.Crypto.UtilCrypto.CheckStringHashHex(), and IG.Crypto.UtilCrypto.CheckStringHashSupportedTypesHex().

static string IG.Lib.Util.CollectionToString | ( | System.Collections.ICollection | list,
|  | bool | addNewlines,
|  | int | numIndent
| ) |  |
| inline static

Returns a string representing the specified collection of objects. Each object is printeed by its ToString() method. Works on all collections, including lists and arrays.

Parameters

  list | Collection to be converted to srting.
  addNewlines | If true then a newline is added before each element printed.
  numIndent | Number of spaces aded before each element.

Referenced by IG.Lib.RegisterableExamples.ExampleIdGenerator(), IG.Lib.RegisterableExamples.ExampleRegistrable(), and IG.Crypto.UtilCrypto.ToString().

static string IG.Lib.Util.CollectionToString | ( | System.Collections.ICollection | list | ) |
| inline static

Returns a string representing the specified collection of objects. Each object is printeed by its ToString() method. A newline and two spaces are added before each element printed. Works on all collections, including lists and arrays.

Parameters

  list | Collection to be converted to srting.

static string IG.Lib.Util.CollectionToStringLong | ( | System.Collections.ICollection | collection,
|  | bool | addNewlines,
|  | int | numIndent
| ) |  |
| inline static

Returns a string representing the specified list in long form. Count property (i.e. number of elements in collection) is also printed. Works on all collections, including lists and arrays.

Parameters

  collection | Collection to be converted to srting.
  addNewlines | If true then a newline is added before each element printed.
  numIndent | Number of spaces aded before each element.

static string IG.Lib.Util.CollectionToStringLong | ( | System.Collections.ICollection | collection | ) |
| inline static

Returns a string representing the specified list in long form. Count property (i.e. number of elements in collection) is also printed. Works on all collections, including lists and arrays. A newline and two spaces are added before each element printed.

Parameters

  collection | Collection to be converted to srting.

static string IG.Lib.Util.ListToString< T > | ( | List< T > | list,
|  | bool | addNewlines,
|  | int | numIndent
| ) |  |
| inline static

Returns a string representing the specified generic list in short form (without count and capacity).

Template Parameters

  T | Type of list elements.

Parameters

  list | List to be converted to srting.
  addNewlines | If true then a newline is added before each element printed.
  numIndent | Number of spaces aded before each element.

static string IG.Lib.Util.ListToString< T > | ( | List< T > | list | ) |
| inline static

Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. A newline and two spaces are added before each element printed.

Template Parameters

  T | Type of list elements.

Parameters

  list | List to be converted to srting.

static string IG.Lib.Util.ListToStringLong< T > | ( | List< T > | list,
|  | bool | addNewlines,
|  | int | numIndent
| ) |  |
| inline static

Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed.

Template Parameters

  T | Type of list elements.

Parameters

  list | List to be converted to srting.
  addNewlines | If true then a newline is added before each element printed.
  numIndent | Number of spaces aded before each element.

static string IG.Lib.Util.ListToStringLong< T > | ( | List< T > | list | ) |
| inline static

Returns a string representing the specified generic list in long form. Count and Capacity properties are also printed. A newline and two spaces are added before each element printed.

Template Parameters

  T | Type of list elements.

Parameters

  list | List to be converted to srting.

static string IG.Lib.Util.ObjectToString< ObjectType > | ( | ObjectType | obj | ) |
| inline static

Converts obect of the specified type to its string representation, where numbers are converted in ivariant culture (ignoring any localization settings).

This method can be used to avoid problems with differen local settinggs when transfering numerical values through text files.

Template Parameters

  ObjectType | Type of the object to be converted to string.

Parameters

  obj | Object to be converted.

static string IG.Lib.Util.ObjectToString< ObjectType > | ( | ObjectType | obj,
|  | System.Globalization.CultureInfo | cultureInfo
| ) |  |
| inline static

Converts obect of the specified type to its string representation, where numbers are converted in ivariant culture (ignoring any localization settings).

This method can be used to avoid problems with differen local settinggs when transfering numerical values through text files.

Template Parameters

  ObjectType | Type of the object to be converted to string.

Parameters

  obj | Object to be converted.
  cultureInfo | Culture info used in conversion.

static bool IG.Lib.Util.IsNumeric< ObjectType > | ( | ObjectType | obj | ) |
| inline static

Returns a flag indicating whether the specified object is of numeric type (such as int, float, double, etc.).

When called on an arbitrary object, the correct type parameter will be inferred, and we can get the desired information if

Template Parameters

  ObjectType | Type of the object that is queried.

Parameters

  obj | Object for which we query whether it represents a numerical value.

static bool IG.Lib.Util.IsNumericOld | ( | object | expression | ) |
| inline static protected

Returns true if the specified expression or object is of numeric type (such as int, float, double, etc.), and false otherwise.

Parameters

  expression | Expression that is checked for being of numeric type.

static void IG.Lib.Util.TestToString | ( |  | ) |
| inline static

Test conversion to strings with invariant culture info.

static bool IG.Lib.Util.TryParse< ReturnType > | ( | string | strValue,
|  | ref ReturnType | parsedValue
| ) |  |
| inline static

Tries to parse a string representation of an object of the specified type and return it through output argument. Invariant culture is used in parsing.

Template Parameters

  ReturnType | Type of the object whose value is tried to be parsed from the string.

Parameters

  strValue | String that is converted to obect of the specified type.
  parsedValue | Value (of the specified type)vthat is obtained from the parsed string.

Returns
  true if string was successfully converted to the object of the specified type, false if not (in this case parsedValue retains its previous value).

static ReturnType IG.Lib.Util.Parse< ReturnType > | ( | string | strValue | ) |
| inline static

Converts a string to the object of the specified type and returns the entity, by using the invariant culture.

This works for simple types, for complex types deserialization must be used.

Template Parameters

  ReturnType | Type of the entity to be returned, can be int.

Parameters

  strValue | String to be converted to other type.

Returns
  Object of the specified type converted form a string.

static object IG.Lib.Util.Parse | ( | string | strValue,
|  | Type | propertyType
| ) |  |
| inline static

Converts a string to the entity of the specified type and returns that entity, by using invariant culture.

This works for simple types, for complex types deserialization must be used.

Parameters

  strValue | String to be converted to other type.
  propertyType | Type of the entity to be parsed from a string.

Returns
  Object of the specified type converted form a string.

Referenced by IG.Lib.StringTable.GetElement< ElementType >().

static bool IG.Lib.Util.TryParse< ReturnType > | ( | string | strValue,
|  | ref ReturnType | parsedValue,
|  | System.Globalization.CultureInfo | cultureInfo
| ) |  |
| inline static

Tries to parse a string representation of an object of the specified type and return it through output argument.

Template Parameters

  ReturnType | Type of the object whose value is tried to be parsed from the string.

Parameters

  strValue | String that is converted to obect of the specified type.
  parsedValue | Value (of the specified type)vthat is obtained from the parsed string.
  cultureInfo | Culture info used in conversion.

Returns
  true if string was successfully converted to the object of the specified type, false if not (in this case parsedValue retains its previous value).

static ReturnType IG.Lib.Util.Parse< ReturnType > | ( | string | strValue,
|  | System.Globalization.CultureInfo | cultureInfo
| ) |  |
| inline static

Converts a string to the object of the specified type and returns the entity, by using the specified culture info.

This works for simple types, for complex types deserialization must be used.

Template Parameters

  ReturnType | Type of the entity to be returned, can be int.

Parameters

  strValue | String to be converted to other type.
  cultureInfo | Culture info used in conversion.

Returns
  Object of the specified type converted form a string.

static object IG.Lib.Util.Parse | ( | string | strValue,
|  | Type | propertyType,
|  | System.Globalization.CultureInfo | cultureInfo
| ) |  |
| inline static

Converts a string to the entity of the specified type and returns that entity.

This works for simple types, for complex types deserialization must be used.

Parameters

  strValue | String to be converted to other type.
  propertyType | Type of the entity to be parsed from a string.
  cultureInfo | Culture info used in conversion.

Returns
  Object of the specified type converted form a string.

static bool IG.Lib.Util.TryParseBoolean | ( | string | str,
|  | ref bool | parsedValue
| ) |  |
| inline static

Tries to parse a string representation of a boolean.

Parameters

  str | String that is converted to boolean.
  parsedValue | Boolean value parsed from the specified string.

Returns
  true if string was successfully converted to boolean, false if not (in this case parsedValue retains its previous value).

Referenced by IG.Script.ScriptAppBase.AssemblyFunctionInfo(), IG.Script.ScriptAppBase.AssemblyFunctionReferenced(), IG.Script.ScriptAppBase.AssemblyFunctionResources(), IG.Lib.CommandLineApplicationInterpreter.CmdAbout(), IG.Lib.CommandLineApplicationInterpreter.CmdApplicationInfo(), IG.Lib.CommandLineApplicationInterpreter.CmdBlock(), IG.Lib.CommandLineApplicationInterpreter.CmdElseIf(), IG.Lib.CommandLineApplicationInterpreter.CmdIf(), IG.Lib.CommandLineApplicationInterpreter.CmdPipeClientCreate(), IG.Lib.CommandLineApplicationInterpreter.CmdPipeServerCreate(), IG.Lib.CommandLineApplicationInterpreter.CmdPrintParallelCommands(), IG.Lib.CommandLineApplicationInterpreter.CmdSuppressInteractive(), IG.Lib.CommandLineApplicationInterpreter.CmdSuppressInteractiveFrame(), IG.Lib.CommandLineApplicationInterpreter.CmdThreadInfo(), IG.Lib.CommandLineApplicationInterpreter.CmdThtrowExceptions(), IG.Lib.CommandLineApplicationInterpreter.CmdUseJint(), IG.Script.LoadableScriptShellNeuralBase.CreateDistortedModelData(), IG.Lib.CommandLineApplicationInterpreter.ExitWhile(), IG.Script.AppExtBase.FormDemoFunctionCookingTimer(), IG.Script.AppExtBase.FormDemoFunctionOpenFormOld(), IG.Script.AppExtBase.FormDemoFunctionOpenFormOrControl(), IG.Script.AppExtBase.FormDemoFunctionStopWatch(), and IG.Gr3d.VtkFormsExamples.Plot3dFunctionVtkControl().

static bool IG.Lib.Util.ParseBoolean | ( | string | str | ) |
| inline static

Converts the specified string to a boolean value, if possible, and returns it. If conversion is not possible then exception is thrown. Recognized representations of true: "true", "1", "yes", "y" (case insensitive). Recognized representations of false: "false", "0", "no", "n" (case insensitive).

Parameters

  str | String representation of boolean to beparsed.

Returns
  Boolean value represented by the specified string.

Exceptions

  System.ArgumentNullException | When the string is null.
  System.FormatException | When the string can not represent a boolean value.

Referenced by IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvReadDefinitionAndData(), IG.Script.ScriptAppBase.DataStructuresFunctionTestCsvWriteDefinitionAndData(), IG.Script.ScriptAppBase.FileFunctionWaitCreation(), IG.Script.ScriptAppBase.ProcessFunctionKillApplications(), IG.Script.ScriptAppBase.ProcessFunctionKillApplicationsByWindow(), IG.Script.ScriptAppBase.ProcessFunctionKillProcesses(), IG.Script.ScriptAppBase.ProcessFunctionListApplications(), IG.Script.ScriptAppBase.ProcessFunctionListApplicationsByWindow(), and IG.Script.ScriptAppBase.ProcessFunctionListProcesses().

static bool IG.Lib.Util.TryParseThreadPriority | ( | string | str,
|  | ref ThreadPriority | parsedValue
| ) |  |
| inline static

Tries to parse a string representation of a ThreadPriority enum.

Parameters

  str | String that is converted to a ThreadPriority value.
  parsedValue | Boolean value parsed from the specified string.

Returns
  true if string was successfully converted to ThreadPriority, false if not (in this case parsedValue retains its previous value).

See also
  Util.ParseThreadPriority

Referenced by IG.Lib.CommandLineApplicationInterpreter.CmdSetPriority().

static ThreadPriority IG.Lib.Util.ParseThreadPriority | ( | string | str | ) |
| inline static

Converts the specified string to a ThreadPriority enum value, if possible, and returns it. If conversion is not possible then exception is thrown.

Recognized representations (not case sensitive):

ThreadPriority.Lowest: "0", "lowest", "idle"

ThreadPriority.BelowNormal: "1", "belownormal", "low"

ThreadPriority.Normal: "2", "normal"

ThreadPriority.AboveNormal: "3", "abovenormal", "high"

ThreadPriority.Highest: "4", "Highest", "realtime"

Parameters

  str | String representation of a ThreadPriority value to be parsed.

Returns
  The ThreadPriority value represented by the specified string.

Exceptions

  System.ArgumentNullException | When the string is null.
  System.FormatException | When the string can not represent a boolean value.

static string IG.Lib.Util.XmlToString | ( | string | xmlString,
|  | string | indentCahrs = `" "`,
|  | string | newlineChars = `null`
| ) |  |
| inline static

Returns a reformatted XML string, eventually in a more human readable form.

Parameters

  xmlString | String containing the XML to be returned in a reformatted form.
  indentCahrs | String used for indentation (default is string containing two space characters). Default is two space characters. If null or empty srting then no indentation id used.
  newlineChars | Character used for newlines. If null then Environment.NewLine is used.

Referenced by IG.Crypto.CryptoManager.AppAsymExportKey(), IG.Crypto.CryptoManager.AppAsymKeyInfo(), and IG.Crypto.CryptoManager.AppAsymTest().

static string IG.Lib.Util.XmlToString | ( | XmlDocument | doc,
|  | string | indentCahrs = `" "`,
|  | string | newlineChars = `null`
| ) |  |
| inline static

Converts the specified XML document to string, eventually with human readable indentation and newlines added. The stirng representation is returned.

Parameters

  doc | XML documennt to be converted to a string.
  indentCahrs | String used for indentation (default is string containing two space characters). Default is two space characters. If null or empty srting then no indentation id used.
  newlineChars | Character used for newlines. If null then Environment.NewLine is used.

static void IG.Lib.Util.ExampleList | ( |  | ) |
| inline static

## Member Data Documentation

object IG.Lib.Util._lockGlobal = new object()
| static private

const string IG.Lib.Util.MutexGlobalName = "Global\\IG.Lib.Utils.MutexGlobal.R2D2_by_Igor_Gresovnik"

Name of the global mutex.

volatile Mutex IG.Lib.Util._mutexGlobal
| static protected

volatile int IG.Lib.Util._outputLevel = 0
| static private

const string IG.Lib.Util.NullRepresentationString = "null"

Standard string representation of null values of objects (often used when overriding object.ToString method).

Referenced by IG.Lib.Util.GetHashFunctionInt(), IG.Num.VectorBase.ToString(), and IG.Num.MatrixBase.ToStringReadable().

volatile int IG.Lib.Util._maxLengthIntToString
| static private

readonly ConcurrentDictionary<Type, int> IG.Lib.Util._cache = new ConcurrentDictionary<Type, int>()
| static private

byte [] IG.Lib.Util._auxBytes = null
| static private

const string IG.Lib.Util.IGLibUrl = "http://www2.arnes.si/~ljc3m2/igor/iglib/"

Referenced by IG.Forms.BrowserSimpleControl.MenuHelp_About_Click().

const string IG.Lib.Util.IGLibCodeDocumentationUrl = "http://www2.arnes.si/~fgreso/code_documentation/generated/iglib/html/index.html"

const string IG.Lib.Util.IGLibAuthor = "Igor Grešovnik"

## Property Documentation

object IG.Lib.Util.LockGlobal
| static get

Global, process-level locking object.

This object can be used for synchronization of any static methods.

Warning: Do not use this lock for locking long lasting operations, since this can result in deadlocks.

Referenced by IG.Lib.ScriptLoaderBase.AddDefaultAssemblies(), IG.Lib.ScriptLoaderBase.ClearDefaultAssemblies(), IG.Crypto.UtilCrypto.GetAsymmetricAlgorithmTypes(), IG.Crypto.UtilCrypto.GetHashTypes(), IG.Forms.TestControl.GetNextId(), IG.Crypto.UtilCrypto.GetPasswordAlgorithmNoneSingleton(), IG.Crypto.UtilCrypto.GetPasswordAlgorithmTypes(), IG.Crypto.UtilCrypto.GetSymmetricAlgorithmTypes(), and IG.Lib.ScriptLoaderBase.RemoveDefaultAssemblies().

Mutex IG.Lib.Util.MutexGlobal
| static get

Mutex for system-wide exclusive locks.

int IG.Lib.Util.OutputLevel
| static get set

Serves as default output level for new objects of many classes that include the output level property (usually named "OutputLevel"). Such a property defines how much information about operation of the object is ouput to the console.

General guidlines for use of the output level property in classes:

The property usually defineds the quantity of output produced by an object of a class that implements this property. It is not strictly prescribed what certain values of the property mean. By loose agreement, any negative value means unspecified output level (property not yet initialized), 0 means that no output is produced, 1 means only the most important information is ouptut and higher values mean that more detailed information about operation is output to the console.

For example application, see e.g. the IG.Gr.PlotterZedGraph in the 2D plotting library that uses IGLib.

Referenced by IG.Lib.ShellApplication< InterpreterType >.AplicationMain(), IG.Lib.UtilSystem.CopyDirectorySafe(), IG.Lib.UtilSystem.CopyRecursive(), IG.Lib.UtilSystem.CopyRecursiveSafe(), IG.Lib.UtilSystem.ExampleCopyDir(), IG.Lib.UtilSystem.GetMacAddressFastest(), IG.Lib.UtilSystem.KillAllApplications(), IG.Lib.UtilSystem.KillAllApplicationsByWindowTitle(), IG.Lib.UtilSystem.KillAllProcesses(), IG.Lib.UtilSystem.KillFirstApplication(), IG.Lib.UtilSystem.KillFirstApplicationByWindowTitle(), and IG.Lib.UtilSystem.KillFirstProcess().

The documentation for this class was generated from the following file:

- igbase/utilities/Utils.cs