Crosstales.ExtensionMethods Class Reference

Various extension methods. More...

Static Public Member Functions

static string CTToTitleCase (this string str)
 Extension method for strings. Converts a string to title case (first letter uppercase). More...
 
static string CTReverse (this string str)
 Extension method for strings. Reverses a string. More...
 
static string CTReplace (this string str, string oldString, string newString, System.StringComparison comp=System.StringComparison.OrdinalIgnoreCase)
 Extension method for strings. Default: case insensitive 'Replace'. More...
 
static string CTRemoveChars (this string str, params char[] removeChars)
 Extension method for strings. Removes characters from a string More...
 
static bool CTEquals (this string str, string toCheck, System.StringComparison comp=System.StringComparison.OrdinalIgnoreCase)
 Extension method for strings. Default: case insensitive 'Equals'. More...
 
static bool CTContains (this string str, string toCheck, System.StringComparison comp=System.StringComparison.OrdinalIgnoreCase)
 Extension method for strings. Default: case insensitive 'Contains'. More...
 
static bool CTContainsAny (this string str, string searchTerms, char splitChar=' ')
 Extension method for strings. Contains any given string. More...
 
static bool CTContainsAll (this string str, string searchTerms, char splitChar=' ')
 Extension method for strings. Contains all given strings. More...
 
static string CTRemoveNewLines (this string str, string replacement="#nl#", string newLine=null)
 Extension method for strings. Replaces new lines with a replacement string pattern. More...
 
static string CTAddNewLines (this string str, string replacement="#nl#", string newLine=null)
 Extension method for strings. Replaces a given string pattern with new lines in a string. More...
 
static bool CTisNumeric (this string str)
 Extension method for strings. Checks if the string is numeric. More...
 
static bool CTIsNumeric (this string str)
 Extension method for strings. Checks if the string is numeric. More...
 
static bool CTisInteger (this string str)
 Extension method for strings. Checks if the string is integer. More...
 
static bool CTIsInteger (this string str)
 Extension method for strings. Checks if the string is integer. More...
 
static bool CTisEmail (this string str)
 Extension method for strings. Checks if the string is an email address. More...
 
static bool CTIsEmail (this string str)
 Extension method for strings. Checks if the string is an email address. More...
 
static bool CTisWebsite (this string str)
 Extension method for strings. Checks if the string is a website address. More...
 
static bool CTIsWebsite (this string str)
 Extension method for strings. Checks if the string is a website address. More...
 
static bool CTisCreditcard (this string str)
 Extension method for strings. Checks if the string is a creditcard. More...
 
static bool CTIsCreditcard (this string str)
 Extension method for strings. Checks if the string is a creditcard. More...
 
static bool CTisIPv4 (this string str)
 Extension method for strings. Checks if the string is an IPv4 address. More...
 
static bool CTIsIPv4 (this string str)
 Extension method for strings. Checks if the string is an IPv4 address. More...
 
static bool CTisAlphanumeric (this string str)
 Extension method for strings. Checks if the string is alphanumeric. More...
 
static bool CTIsAlphanumeric (this string str)
 Extension method for strings. Checks if the string is alphanumeric. More...
 
static bool CThasLineEndings (this string str)
 Extension method for strings. Checks if the string has line endings. More...
 
static bool CTHasLineEndings (this string str)
 Extension method for strings. Checks if the string has line endings. More...
 
static bool CThasInvalidChars (this string str)
 Extension method for strings. Checks if the string has invalid characters. More...
 
static bool CTHasInvalidChars (this string str)
 Extension method for strings. Checks if the string has invalid characters. More...
 
static bool CTStartsWith (this string str, string toCheck, System.StringComparison comp=System.StringComparison.OrdinalIgnoreCase)
 Extension method for strings. Checks if the string starts with another string. More...
 
static bool CTEndsWith (this string str, string toCheck, System.StringComparison comp=System.StringComparison.OrdinalIgnoreCase)
 Extension method for strings. Checks if the string ends with another string. More...
 
static int CTLastIndexOf (this string str, string toCheck, System.StringComparison comp=System.StringComparison.OrdinalIgnoreCase)
 Extension method for strings. Returns the index of the last occurence of a given string. More...
 
static int CTIndexOf (this string str, string toCheck, System.StringComparison comp=System.StringComparison.OrdinalIgnoreCase)
 Extension method for strings. Returns the index of the first occurence of a given string. More...
 
static int CTIndexOf (this string str, string toCheck, int startIndex, System.StringComparison comp=System.StringComparison.OrdinalIgnoreCase)
 Extension method for strings. Returns the index of the first occurence of a given string. More...
 
static string CTToBase64 (this string str, System.Text.Encoding encoding=null)
 Extension method for strings. Converts the value of a string to a Base64-string. More...
 
static string CTFromBase64 (this string str, System.Text.Encoding encoding=null)
 Extension method for strings. Converts the value of a Base64-string to a string. More...
 
static byte[] CTFromBase64ToByteArray (this string str)
 Extension method for strings. Converts the value of a Base64-string to a byte-array. More...
 
static string CTToHex (this string str, bool addPrefix=false)
 Extension method for strings. Converts the value of a string to a Hex-string (with Unicode support). More...
 
static string CTHexToString (this string hexString)
 Extension method for strings. Converts the Hex-value of a string to a string (with Unicode support). More...
 
static Color32 CTHexToColor32 (this string hexString)
 Extension method for strings. Converts the Hex-value of a string to a Color32. More...
 
static Color CTHexToColor (this string hexString)
 Extension method for strings. Converts the Hex-value of a string to a Color. More...
 
static byte[] CTToByteArray (this string str, System.Text.Encoding encoding=null)
 Extension method for strings. Converts the value of a string to a byte-array. More...
 
static string CTClearTags (this string str)
 Extension method for strings. Cleans a given text from tags. More...
 
static string CTClearSpaces (this string str)
 Extension method for strings. Cleans a given text from multiple spaces. More...
 
static string CTClearLineEndings (this string str)
 Extension method for strings. Cleans a given text from line endings. More...
 
static void CTShuffle< T > (this T[] array, int seed=0)
 Extension method for arrays. Shuffles an array. More...
 
static string CTDump< T > (this T[] array, string prefix="", string postfix="", bool appendNewLine=true, string delimiter="; ")
 Extension method for arrays. Dumps an array to a string. More...
 
static string CTDump (this Quaternion[] array)
 Extension method for Quaternion-arrays. Dumps an array to a string. More...
 
static string CTDump (this Vector2[] array)
 Extension method for Vector2-arrays. Dumps an array to a string. More...
 
static string CTDump (this Vector3[] array)
 Extension method for Vector3-arrays. Dumps an array to a string. More...
 
static string CTDump (this Vector4[] array)
 Extension method for Vector4-arrays. Dumps an array to a string. More...
 
static string[] CTToStringArray< T > (this T[] array)
 Extension method for arrays. Generates a string array with all entries (via ToString). More...
 
static float[] CTToFloatArray (this byte[] array, int count=0)
 Extension method for byte-arrays. Converts a byte-array to a float-array. More...
 
static byte[] CTToByteArray (this float[] array, int count=0)
 Extension method for float-arrays. Converts a float-array to a byte-array. More...
 
static Texture2D CTToTexture (this byte[] data, Texture2D supportTexture=null)
 Extension method for byte-arrays. Converts a byte-array to a Texture. Supported image formats: PNG and JPG. More...
 
static Sprite CTToSprite (this byte[] data, Texture2D supportTexture=null)
 Extension method for byte-arrays. Converts a byte-array to a Sprite. Supported image formats: PNG and JPG. More...
 
static string CTToString (this byte[] data, System.Text.Encoding encoding=null)
 Extension method for byte-arrays. Converts a byte-array to a string. More...
 
static string CTToBase64 (this byte[] data)
 Extension method for byte-arrays. Converts a byte-array to a Base64-string. More...
 
static T[] GetColumn< T > (this T[,] matrix, int columnNumber)
 Extension method for 2D-arrays. Returns the column of a 2D-array as array. More...
 
static T[] GetRow< T > (this T[,] matrix, int rowNumber)
 Extension method for 2D-arrays. Returns the row of a 2D-array as array. More...
 
static void CTShuffle< T > (this System.Collections.Generic.IList< T > list, int seed=0)
 Extension method for IList. Shuffles a List. More...
 
static string CTDump< T > (this System.Collections.Generic.IList< T > list, string prefix="", string postfix="", bool appendNewLine=true, string delimiter="; ")
 Extension method for IList. Dumps a list to a string. More...
 
static string CTDump (this System.Collections.Generic.IList< Quaternion > list)
 Extension method for Quaternion-IList. Dumps a list to a string. More...
 
static string CTDump (this System.Collections.Generic.IList< Vector2 > list)
 Extension method for Vector2-IList. Dumps a list to a string. More...
 
static string CTDump (this System.Collections.Generic.IList< Vector3 > list)
 Extension method for Vector3-IList. Dumps a list to a string. More...
 
static string CTDump (this System.Collections.Generic.IList< Vector4 > list)
 Extension method for Vector4-IList. Dumps a list to a string. More...
 
static System.Collections.Generic.List< string > CTToString< T > (this System.Collections.Generic.IList< T > list)
 Extension method for IList. Generates a string list with all entries (via ToString). More...
 
static string CTDump< K, V > (this System.Collections.Generic.IDictionary< K, V > dict, string prefix="", string postfix="", bool appendNewLine=true, string delimiter="; ")
 Extension method for IDictionary. Dumps a dictionary to a string. More...
 
static void CTAddRange< K, V > (this System.Collections.Generic.IDictionary< K, V > dict, System.Collections.Generic.IDictionary< K, V > collection)
 Extension method for IDictionary. Adds a dictionary to an existing one. More...
 
static byte[] CTReadFully (this System.IO.Stream input)
 Extension method for Stream. Reads the full content of a Stream. More...
 
static string CTToHexRGB (this Color32 input)
 Extension method for Color32. Converts the value of a color to a RGB Hex-string. More...
 
static string CTToHexRGB (this Color input)
 Extension method for Color. Converts the value of a color to a RGB Hex-string. More...
 
static string CTToHexRGBA (this Color32 input)
 Extension method for Color32. Converts the value of a color to a RGBA Hex-string. More...
 
static string CTToHexRGBA (this Color input)
 Extension method for Color. Converts the value of a color to a RGBA Hex-string. More...
 
static Vector3 CTVector3 (this Color32 color)
 Extension method for Color32. Convert it to a Vector3. More...
 
static Vector3 CTVector3 (this Color color)
 Extension method for Color. Convert it to a Vector3. More...
 
static Vector4 CTVector4 (this Color32 color)
 Extension method for Color32. Convert it to a Vector4. More...
 
static Vector4 CTVector4 (this Color color)
 Extension method for Color. Convert it to a Vector4. More...
 
static Vector2 CTMultiply (this Vector2 a, Vector2 b)
 Allows you to multiply two Vector2s together, something Unity sorely lacks by default. More...
 
static Vector3 CTMultiply (this Vector3 a, Vector3 b)
 Allows you to multiply two Vector3s together, something Unity sorely lacks by default. More...
 
static Vector3 CTFlatten (this Vector3 a)
 Returns a Vector3 with a 0 y-axis. This is useful for keeping entities oriented perpendicular to the ground. More...
 
static Quaternion CTQuaternion (this Vector3 eulerAngle)
 Extension method for Vector3. Convert it to a Quaternion. More...
 
static Color CTColorRGB (this Vector3 rgb, float alpha=1f)
 Extension method for Vector3. Convert it to a Color. More...
 
static Vector4 CTMultiply (this Vector4 a, Vector4 b)
 Allows you to multiply two Vector4s together, something Unity sorely lacks by default. More...
 
static Quaternion CTQuaternion (this Vector4 angle)
 Extension method for Vector4. Convert it to a Quaternion. More...
 
static Color CTColorRGBA (this Vector4 rgba)
 Extension method for Vector4. Convert it to a Color. More...
 
static Vector3 CTVector3 (this Quaternion angle)
 Extension method for Quaternion. Convert it to a Vector3. More...
 
static Vector4 CTVector4 (this Quaternion angle)
 Extension method for Quaternion. Convert it to a Vector4. More...
 
static Vector3 CTCorrectLossyScale (this Canvas canvas)
 Extension method for Canvas. Convert current resolution scale. More...
 
static void CTGetLocalCorners (this RectTransform transform, Vector3[] fourCornersArray, Canvas canvas, float inset=0, bool corrected=false)
 Extension method for RectTransform. Sets the local corners of a RectTransform to a given array. More...
 
static Vector3[] CTGetLocalCorners (this RectTransform transform, Canvas canvas, float inset=0, bool corrected=false)
 Extension method for RectTransform. Returns the local corners of a RectTransform. More...
 
static void CTGetScreenCorners (this RectTransform transform, Vector3[] fourCornersArray, Canvas canvas, float inset=0, bool corrected=false)
 Extension method for RectTransform. Sets the world corners of a RectTransform to a given array. More...
 
static Vector3[] CTGetScreenCorners (this RectTransform transform, Canvas canvas, float inset=0, bool corrected=false)
 Extension method for RectTransform. Returns the screen (world) corners of a RectTransform. More...
 
static Bounds CTGetBounds (this RectTransform transform, float uiScaleFactor=1f)
 Extension method for RectTransform. Returns the bounds of a RectTransform including the children. More...
 
static void CTSetLeft (this RectTransform transform, float value)
 Extension method for RectTransform. Sets the Left-property of a RectTransform. More...
 
static void CTSetRight (this RectTransform transform, float value)
 Extension method for RectTransform. Sets the Right-property of a RectTransform. More...
 
static void CTSetTop (this RectTransform transform, float value)
 Extension method for RectTransform. Sets the Top-property of a RectTransform. More...
 
static void CTSetBottom (this RectTransform transform, float value)
 Extension method for RectTransform. Sets the Bottom-property of a RectTransform. More...
 
static float CTGetLeft (this RectTransform transform)
 Extension method for RectTransform. Gets the Left-property of a RectTransform. More...
 
static float CTGetRight (this RectTransform transform)
 Extension method for RectTransform. Gets the Right-property of a RectTransform. More...
 
static float CTGetTop (this RectTransform transform)
 Extension method for RectTransform. Gets the Top-property of a RectTransform. More...
 
static float CTGetBottom (this RectTransform transform)
 Extension method for RectTransform. Gets the Bottom-property of a RectTransform. More...
 
static Vector4 CTGetLRTB (this RectTransform transform)
 Extension method for RectTransform. Gets the Left/Right/Top/Bottom-properties of a RectTransform. More...
 
static void CTSetLRTB (this RectTransform transform, Vector4 lrtb)
 Extension method for RectTransform. Sets the Left/Right/Top/Bottom-properties of a RectTransform. More...
 
static System.Collections.Generic.List< GameObject > CTFindAll (this Component component, string name, int maxDepth=0)
 Extension method for Component. Recursively searches all children of a parent Component for specific named GameObjects More...
 
static System.Collections.Generic.List< T > CTFindAll< T > (this Component component, string name)
 Extension method for Component. Recursively searches all children of a parent Component for specific named GameObjects More...
 
static GameObject CTFind (this MonoBehaviour mb, string name)
 Extension method for MonoBehaviour. Recursively searches all children of a parent MonoBehaviour for specific named GameObject More...
 
static T CTFind< T > (this MonoBehaviour mb, string name)
 Extension method for MonoBehaviour. Recursively searches all children of a parent MonoBehaviour for specific named GameObject and returns a component. More...
 
static GameObject CTFind (this GameObject go, string name)
 Extension method for GameObject. Recursively searches all children of a parent GameObject for specific named GameObject More...
 
static T CTFind< T > (this GameObject go, string name)
 Extension method for GameObject. Recursively searches all children of a parent GameObject for specific named GameObject and returns a component. More...
 
static Bounds CTGetBounds (this GameObject go)
 Extension method for GameObject. Returns the bounds of a GameObject including the children. More...
 
static Transform CTFind (this Transform transform, string name)
 Extension method for Transform. Recursively searches all children of a parent transform for specific named transform More...
 
static T CTFind< T > (this Transform transform, string name)
 Extension method for Transform. Recursively searches all children of a parent transform for specific named transform and returns a component. More...
 
static byte[] CTToPNG (this Sprite sprite)
 Extension method for Sprite. Converts a Sprite to a PNG byte-array. More...
 
static byte[] CTToJPG (this Sprite sprite)
 Extension method for Sprite. Converts a Sprite to a JPG byte-array. More...
 
static byte[] CTToTGA (this Sprite sprite)
 Extension method for Sprite. Converts a Sprite to a TGA byte-array. More...
 
static byte[] CTToEXR (this Sprite sprite)
 Extension method for Sprite. Converts a Sprite to a EXR byte-array. More...
 
static byte[] CTToPNG (this Texture2D texture)
 Extension method for Texture. Converts a Texture to a PNG byte-array. More...
 
static byte[] CTToJPG (this Texture2D texture)
 Extension method for Texture. Converts a Texture to a JPG byte-array. More...
 
static byte[] CTToTGA (this Texture2D texture)
 Extension method for Texture. Converts a Texture to a TGA byte-array. More...
 
static byte[] CTToEXR (this Texture2D texture)
 Extension method for Texture. Converts a Texture to a EXR byte-array. More...
 
static Sprite CTToSprite (this Texture2D texture, float pixelsPerUnit=100f)
 Extension method for Texture. Converts a Texture to a Sprite. More...
 
static Texture2D CTRotate90 (this Texture2D texture)
 Extension method for Texture. Rotates a Texture by 90 degrees. More...
 
static Texture2D CTRotate180 (this Texture2D texture)
 Extension method for Texture. Rotates a Texture by 180 degrees. More...
 
static Texture2D CTRotate270 (this Texture2D texture)
 Extension method for Texture. Rotates a Texture by 270 degrees. More...
 
static Texture2D CTToTexture2D (this Texture texture)
 Extension method for Texture. Convert a Texture to a Texture2D More...
 
static Texture2D CTToTexture2D (this WebCamTexture texture)
 Extension method for WebCamTexture. Convert a WebCamTexture to a Texture2D More...
 
static Texture2D CTFlipHorizontal (this Texture2D texture)
 Extension method for Texture. Flips a Texture2D horizontally More...
 
static Texture2D CTFlipVertical (this Texture2D texture)
 Extension method for Texture. Flips a Texture2D vertically More...
 
static bool CTHasActiveClip (this AudioSource source)
 Extension method for AudioSource. Determines if an AudioSource has an active clip. More...
 
static void CTAbort (this System.Threading.Thread thread, bool silent=true)
 Extension method for Thread. Aborts a Thread safely and optional silently More...
 
static bool CTIsVisibleFrom (this Renderer renderer, Camera camera)
 Extension method for Renderer. Determines if the renderer is visible from a certain camera. More...
 

Detailed Description

Various extension methods.

Member Function Documentation

◆ CTAbort()

static void Crosstales.ExtensionMethods.CTAbort ( this System.Threading.Thread  thread,
bool  silent = true 
)
static

Extension method for Thread. Aborts a Thread safely and optional silently

Parameters
threadThread to abort.
silentSilently abort the Thread (optional, default: true).

◆ CTAddNewLines()

static string Crosstales.ExtensionMethods.CTAddNewLines ( this string  str,
string  replacement = "#nl#",
string  newLine = null 
)
static

Extension method for strings. Replaces a given string pattern with new lines in a string.

Parameters
strString-instance.
replacementReplacement string pattern (optional, default: "#nl#").
newLineNew line string (optional, default: System.Environment.NewLine).
Returns
Replaced string with new lines.

◆ CTAddRange< K, V >()

static void Crosstales.ExtensionMethods.CTAddRange< K, V > ( this System.Collections.Generic.IDictionary< K, V >  dict,
System.Collections.Generic.IDictionary< K, V >  collection 
)
static

Extension method for IDictionary. Adds a dictionary to an existing one.

Parameters
dictIDictionary-instance.
collectionDictionary to add.

◆ CTClearLineEndings()

static string Crosstales.ExtensionMethods.CTClearLineEndings ( this string  str)
static

Extension method for strings. Cleans a given text from line endings.

Parameters
strInput to clean.
Returns
Clean text without line endings.

◆ CTClearSpaces()

static string Crosstales.ExtensionMethods.CTClearSpaces ( this string  str)
static

Extension method for strings. Cleans a given text from multiple spaces.

Parameters
strInput to clean.
Returns
Clean text without multiple spaces.

◆ CTClearTags()

static string Crosstales.ExtensionMethods.CTClearTags ( this string  str)
static

Extension method for strings. Cleans a given text from tags.

Parameters
strInput to clean.
Returns
Clean text without tags.

◆ CTColorRGB()

static Color Crosstales.ExtensionMethods.CTColorRGB ( this Vector3  rgb,
float  alpha = 1f 
)
static

Extension method for Vector3. Convert it to a Color.

Parameters
rgbVector3-instance to convert (RGB = xyz).
alphaAlpha-value of the color (optional, default: 1).
Returns
Color from RGB.

◆ CTColorRGBA()

static Color Crosstales.ExtensionMethods.CTColorRGBA ( this Vector4  rgba)
static

Extension method for Vector4. Convert it to a Color.

Parameters
rgbaVector4-instance to convert (RGBA = xyzw).
Returns
Color from RGBA.

◆ CTContains()

static bool Crosstales.ExtensionMethods.CTContains ( this string  str,
string  toCheck,
System.StringComparison  comp = System.StringComparison.OrdinalIgnoreCase 
)
static

Extension method for strings. Default: case insensitive 'Contains'.

Parameters
strString-instance.
toCheckString to check.
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
True if the string contains the given string.

◆ CTContainsAll()

static bool Crosstales.ExtensionMethods.CTContainsAll ( this string  str,
string  searchTerms,
char  splitChar = ' ' 
)
static

Extension method for strings. Contains all given strings.

Parameters
strString-instance.
searchTermsSearch terms separated by the given split-character.
splitCharSplit-character (optional, default: ' ')
Returns
True if the string contains all parts of the given string.

◆ CTContainsAny()

static bool Crosstales.ExtensionMethods.CTContainsAny ( this string  str,
string  searchTerms,
char  splitChar = ' ' 
)
static

Extension method for strings. Contains any given string.

Parameters
strString-instance.
searchTermsSearch terms separated by the given split-character.
splitCharSplit-character (optional, default: ' ')
Returns
True if the string contains any parts of the given string.

◆ CTCorrectLossyScale()

static Vector3 Crosstales.ExtensionMethods.CTCorrectLossyScale ( this Canvas  canvas)
static

Extension method for Canvas. Convert current resolution scale.

Parameters
canvasCanvas to convert.
Returns
Vector3 with the correct scale.

◆ CTDump() [1/8]

static string Crosstales.ExtensionMethods.CTDump ( this Quaternion[]  array)
static

Extension method for Quaternion-arrays. Dumps an array to a string.

Parameters
arrayQuaternion-array-instance to dump.
Returns
String with lines for all array entries.

◆ CTDump() [2/8]

static string Crosstales.ExtensionMethods.CTDump ( this System.Collections.Generic.IList< Quaternion >  list)
static

Extension method for Quaternion-IList. Dumps a list to a string.

Parameters
listQuaternion-IList-instance to dump.
Returns
String with lines for all list entries.

◆ CTDump() [3/8]

static string Crosstales.ExtensionMethods.CTDump ( this System.Collections.Generic.IList< Vector2 >  list)
static

Extension method for Vector2-IList. Dumps a list to a string.

Parameters
listVector2-IList-instance to dump.
Returns
String with lines for all list entries.

◆ CTDump() [4/8]

static string Crosstales.ExtensionMethods.CTDump ( this System.Collections.Generic.IList< Vector3 >  list)
static

Extension method for Vector3-IList. Dumps a list to a string.

Parameters
listVector3-IList-instance to dump.
Returns
String with lines for all list entries.

◆ CTDump() [5/8]

static string Crosstales.ExtensionMethods.CTDump ( this System.Collections.Generic.IList< Vector4 >  list)
static

Extension method for Vector4-IList. Dumps a list to a string.

Parameters
listVector4-IList-instance to dump.
Returns
String with lines for all list entries.

◆ CTDump() [6/8]

static string Crosstales.ExtensionMethods.CTDump ( this Vector2[]  array)
static

Extension method for Vector2-arrays. Dumps an array to a string.

Parameters
arrayVector2-array-instance to dump.
Returns
String with lines for all array entries.

◆ CTDump() [7/8]

static string Crosstales.ExtensionMethods.CTDump ( this Vector3[]  array)
static

Extension method for Vector3-arrays. Dumps an array to a string.

Parameters
arrayVector3-array-instance to dump.
Returns
String with lines for all array entries.

◆ CTDump() [8/8]

static string Crosstales.ExtensionMethods.CTDump ( this Vector4[]  array)
static

Extension method for Vector4-arrays. Dumps an array to a string.

Parameters
arrayVector4-array-instance to dump.
Returns
String with lines for all array entries.

◆ CTDump< K, V >()

static string Crosstales.ExtensionMethods.CTDump< K, V > ( this System.Collections.Generic.IDictionary< K, V >  dict,
string  prefix = "",
string  postfix = "",
bool  appendNewLine = true,
string  delimiter = "; " 
)
static

Extension method for IDictionary. Dumps a dictionary to a string.

Parameters
dictIDictionary-instance to dump.
prefixPrefix for every element (optional, default: empty).
postfixPostfix for every element (optional, default: empty).
appendNewLineAppend new line, otherwise use the given delimiter (optional, default: false).
delimiterDelimiter if appendNewLine is false (optional, default: "; ").
Returns
String with lines for all dictionary entries.

◆ CTDump< T >() [1/2]

static string Crosstales.ExtensionMethods.CTDump< T > ( this System.Collections.Generic.IList< T >  list,
string  prefix = "",
string  postfix = "",
bool  appendNewLine = true,
string  delimiter = "; " 
)
static

Extension method for IList. Dumps a list to a string.

Parameters
listIList-instance to dump.
prefixPrefix for every element (optional, default: empty).
postfixPostfix for every element (optional, default: empty).
appendNewLineAppend new line, otherwise use the given delimiter (optional, default: false).
delimiterDelimiter if appendNewLine is false (optional, default: "; ").
Returns
String with lines for all list entries.

◆ CTDump< T >() [2/2]

static string Crosstales.ExtensionMethods.CTDump< T > ( this T[]  array,
string  prefix = "",
string  postfix = "",
bool  appendNewLine = true,
string  delimiter = "; " 
)
static

Extension method for arrays. Dumps an array to a string.

Parameters
arrayArray-instance to dump.
prefixPrefix for every element (optional, default: empty).
postfixPostfix for every element (optional, default: empty).
appendNewLineAppend new line, otherwise use the given delimiter (optional, default: false).
delimiterDelimiter if appendNewLine is false (optional, default: "; ").
Returns
String with lines for all array entries.

◆ CTEndsWith()

static bool Crosstales.ExtensionMethods.CTEndsWith ( this string  str,
string  toCheck,
System.StringComparison  comp = System.StringComparison.OrdinalIgnoreCase 
)
static

Extension method for strings. Checks if the string ends with another string.

Parameters
strString-instance.
toCheckString to check.
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
True if the string is integer.

◆ CTEquals()

static bool Crosstales.ExtensionMethods.CTEquals ( this string  str,
string  toCheck,
System.StringComparison  comp = System.StringComparison.OrdinalIgnoreCase 
)
static

Extension method for strings. Default: case insensitive 'Equals'.

Parameters
strString-instance.
toCheckString to check.
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
True if the string contains the given string.

◆ CTFind() [1/3]

static GameObject Crosstales.ExtensionMethods.CTFind ( this GameObject  go,
string  name 
)
static

Extension method for GameObject. Recursively searches all children of a parent GameObject for specific named GameObject

Parameters
goParent of the current children.
nameName of the GameObject.
Returns
GameObject with the given name or null.

◆ CTFind() [2/3]

static GameObject Crosstales.ExtensionMethods.CTFind ( this MonoBehaviour  mb,
string  name 
)
static

Extension method for MonoBehaviour. Recursively searches all children of a parent MonoBehaviour for specific named GameObject

Parameters
mbParent of the current children.
nameName of the GameObject.
Returns
GameObject with the given name or null.

◆ CTFind() [3/3]

static Transform Crosstales.ExtensionMethods.CTFind ( this Transform  transform,
string  name 
)
static

Extension method for Transform. Recursively searches all children of a parent transform for specific named transform

Parameters
transformParent of the current children.
nameName of the transform.
Returns
Transform with the given name or null.

◆ CTFind< T >() [1/3]

static T Crosstales.ExtensionMethods.CTFind< T > ( this GameObject  go,
string  name 
)
static

Extension method for GameObject. Recursively searches all children of a parent GameObject for specific named GameObject and returns a component.

Parameters
goParent of the current children.
nameName of the GameObject.
Returns
Component with the given type or null.

◆ CTFind< T >() [2/3]

static T Crosstales.ExtensionMethods.CTFind< T > ( this MonoBehaviour  mb,
string  name 
)
static

Extension method for MonoBehaviour. Recursively searches all children of a parent MonoBehaviour for specific named GameObject and returns a component.

Parameters
mbParent of the current children.
nameName of the GameObject.
Returns
Component with the given type or null.

◆ CTFind< T >() [3/3]

static T Crosstales.ExtensionMethods.CTFind< T > ( this Transform  transform,
string  name 
)
static

Extension method for Transform. Recursively searches all children of a parent transform for specific named transform and returns a component.

Parameters
transformParent of the current children.
nameName of the transform.
Returns
Component with the given type or null.

◆ CTFindAll()

static System.Collections.Generic.List<GameObject> Crosstales.ExtensionMethods.CTFindAll ( this Component  component,
string  name,
int  maxDepth = 0 
)
static

Extension method for Component. Recursively searches all children of a parent Component for specific named GameObjects

Parameters
componentParent of the current children.
nameName of the GameObject.
maxDepthMaximal depth of the search (default 0, optional).
Returns
List of GameObjects with the given name or empty list.

◆ CTFindAll< T >()

static System.Collections.Generic.List<T> Crosstales.ExtensionMethods.CTFindAll< T > ( this Component  component,
string  name 
)
static

Extension method for Component. Recursively searches all children of a parent Component for specific named GameObjects

Parameters
componentParent of the current children.
nameName of the GameObject.
Returns
List of GameObjects with the given name or empty list.
Type Constraints
T :Component 

◆ CTFlatten()

static Vector3 Crosstales.ExtensionMethods.CTFlatten ( this Vector3  a)
static

Returns a Vector3 with a 0 y-axis. This is useful for keeping entities oriented perpendicular to the ground.

◆ CTFlipHorizontal()

static Texture2D Crosstales.ExtensionMethods.CTFlipHorizontal ( this Texture2D  texture)
static

Extension method for Texture. Flips a Texture2D horizontally

Parameters
textureTexture to flip.
Returns
Horizontally flipped Texture2D.

◆ CTFlipVertical()

static Texture2D Crosstales.ExtensionMethods.CTFlipVertical ( this Texture2D  texture)
static

Extension method for Texture. Flips a Texture2D vertically

Parameters
textureTexture to flip.
Returns
Vertically flipped Texture2D.

◆ CTFromBase64()

static string Crosstales.ExtensionMethods.CTFromBase64 ( this string  str,
System.Text.Encoding  encoding = null 
)
static

Extension method for strings. Converts the value of a Base64-string to a string.

Parameters
strInput Base64-string.
encodingEncoding of the string (optional, default: UTF8).
Returns
Base64-string value as converted string.

◆ CTFromBase64ToByteArray()

static byte [] Crosstales.ExtensionMethods.CTFromBase64ToByteArray ( this string  str)
static

Extension method for strings. Converts the value of a Base64-string to a byte-array.

Parameters
strInput Base64-string.
Returns
Base64-Byte-array from the Base64-string.

◆ CTGetBottom()

static float Crosstales.ExtensionMethods.CTGetBottom ( this RectTransform  transform)
static

Extension method for RectTransform. Gets the Bottom-property of a RectTransform.

Parameters
transformRectTransform to get the Bottom-property.
Returns
Bottom-property of the RectTransform.

◆ CTGetBounds() [1/2]

static Bounds Crosstales.ExtensionMethods.CTGetBounds ( this GameObject  go)
static

Extension method for GameObject. Returns the bounds of a GameObject including the children.

Parameters
goGameObject to calculate the bounds.
Returns
Bounds of the GameObject.

◆ CTGetBounds() [2/2]

static Bounds Crosstales.ExtensionMethods.CTGetBounds ( this RectTransform  transform,
float  uiScaleFactor = 1f 
)
static

Extension method for RectTransform. Returns the bounds of a RectTransform including the children.

Parameters
transformRectTransform to calculate the bounds.
uiScaleFactorScale of the UI (optional, default: 1.0).
Returns
Bounds of the RectTransform.

◆ CTGetLeft()

static float Crosstales.ExtensionMethods.CTGetLeft ( this RectTransform  transform)
static

Extension method for RectTransform. Gets the Left-property of a RectTransform.

Parameters
transformRectTransform to get the Left-property.
Returns
Left-property of the RectTransform.

◆ CTGetLocalCorners() [1/2]

static Vector3 [] Crosstales.ExtensionMethods.CTGetLocalCorners ( this RectTransform  transform,
Canvas  canvas,
float  inset = 0,
bool  corrected = false 
)
static

Extension method for RectTransform. Returns the local corners of a RectTransform.

Parameters
transformRectTransform-instance.
canvasRelevant canvas.
insetInset from the corners (optional, default: 0).
correctedAutomatically adjust scaling (optional, default: false).
Returns
Array of the four local corners of the RectTransform.

◆ CTGetLocalCorners() [2/2]

static void Crosstales.ExtensionMethods.CTGetLocalCorners ( this RectTransform  transform,
Vector3[]  fourCornersArray,
Canvas  canvas,
float  inset = 0,
bool  corrected = false 
)
static

Extension method for RectTransform. Sets the local corners of a RectTransform to a given array.

Parameters
transformRectTransform-instance.
fourCornersArrayCorners for the RectTransform.
canvasRelevant canvas.
insetInset from the corners (optional, default: 0).
correctedAutomatically adjust scaling (optional, default: false).

◆ CTGetLRTB()

static Vector4 Crosstales.ExtensionMethods.CTGetLRTB ( this RectTransform  transform)
static

Extension method for RectTransform. Gets the Left/Right/Top/Bottom-properties of a RectTransform.

Parameters
transformRectTransform to get the Left/Right/Top/Bottom-properties.
Returns
Left/Right/Top/Bottom-properties of the RectTransform as Vector4.

◆ CTGetRight()

static float Crosstales.ExtensionMethods.CTGetRight ( this RectTransform  transform)
static

Extension method for RectTransform. Gets the Right-property of a RectTransform.

Parameters
transformRectTransform to get the Right-property.
Returns
Right-property of the RectTransform.

◆ CTGetScreenCorners() [1/2]

static Vector3 [] Crosstales.ExtensionMethods.CTGetScreenCorners ( this RectTransform  transform,
Canvas  canvas,
float  inset = 0,
bool  corrected = false 
)
static

Extension method for RectTransform. Returns the screen (world) corners of a RectTransform.

Parameters
transformRectTransform-instance.
canvasRelevant canvas.
insetInset from the corners (optional, default: 0).
correctedAutomatically adjust scaling (optional, default: false).
Returns
Array of the four screen (world) corners of the RectTransform.

◆ CTGetScreenCorners() [2/2]

static void Crosstales.ExtensionMethods.CTGetScreenCorners ( this RectTransform  transform,
Vector3[]  fourCornersArray,
Canvas  canvas,
float  inset = 0,
bool  corrected = false 
)
static

Extension method for RectTransform. Sets the world corners of a RectTransform to a given array.

Parameters
transformRectTransform-instance.
fourCornersArrayCorners for the RectTransform.
canvasRelevant canvas.
insetInset from the corners (optional, default: 0).
correctedAutomatically adjust scaling (optional, default: false).

◆ CTGetTop()

static float Crosstales.ExtensionMethods.CTGetTop ( this RectTransform  transform)
static

Extension method for RectTransform. Gets the Top-property of a RectTransform.

Parameters
transformRectTransform to get the Top-property.
Returns
Top-property of the RectTransform.

◆ CTHasActiveClip()

static bool Crosstales.ExtensionMethods.CTHasActiveClip ( this AudioSource  source)
static

Extension method for AudioSource. Determines if an AudioSource has an active clip.

Parameters
sourceAudioSource to check.
Returns
True if the AudioSource has an active clip.

◆ CThasInvalidChars()

static bool Crosstales.ExtensionMethods.CThasInvalidChars ( this string  str)
static

Extension method for strings. Checks if the string has invalid characters.

Parameters
strString-instance.
Returns
True if the string has invalid characters.

◆ CTHasInvalidChars()

static bool Crosstales.ExtensionMethods.CTHasInvalidChars ( this string  str)
static

Extension method for strings. Checks if the string has invalid characters.

Parameters
strString-instance.
Returns
True if the string has invalid characters.

◆ CThasLineEndings()

static bool Crosstales.ExtensionMethods.CThasLineEndings ( this string  str)
static

Extension method for strings. Checks if the string has line endings.

Parameters
strString-instance.
Returns
True if the string has line endings.

◆ CTHasLineEndings()

static bool Crosstales.ExtensionMethods.CTHasLineEndings ( this string  str)
static

Extension method for strings. Checks if the string has line endings.

Parameters
strString-instance.
Returns
True if the string has line endings.

◆ CTHexToColor()

static Color Crosstales.ExtensionMethods.CTHexToColor ( this string  hexString)
static

Extension method for strings. Converts the Hex-value of a string to a Color.

Parameters
hexStringInput as Hex-string.
Returns
Hex-string value as Color.

◆ CTHexToColor32()

static Color32 Crosstales.ExtensionMethods.CTHexToColor32 ( this string  hexString)
static

Extension method for strings. Converts the Hex-value of a string to a Color32.

Parameters
hexStringInput as Hex-string.
Returns
Hex-string value as Color32.

◆ CTHexToString()

static string Crosstales.ExtensionMethods.CTHexToString ( this string  hexString)
static

Extension method for strings. Converts the Hex-value of a string to a string (with Unicode support).

Parameters
hexStringInput as Hex-string.
Returns
Hex-string value as converted string.

◆ CTIndexOf() [1/2]

static int Crosstales.ExtensionMethods.CTIndexOf ( this string  str,
string  toCheck,
int  startIndex,
System.StringComparison  comp = System.StringComparison.OrdinalIgnoreCase 
)
static

Extension method for strings. Returns the index of the first occurence of a given string.

Parameters
strString-instance.
toCheckString for the index.
startIndexStart index for the check.
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
The index of the first occurence of the given string if the string is integer.

◆ CTIndexOf() [2/2]

static int Crosstales.ExtensionMethods.CTIndexOf ( this string  str,
string  toCheck,
System.StringComparison  comp = System.StringComparison.OrdinalIgnoreCase 
)
static

Extension method for strings. Returns the index of the first occurence of a given string.

Parameters
strString-instance.
toCheckString for the index.
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
The index of the first occurence of the given string if the string is integer.

◆ CTisAlphanumeric()

static bool Crosstales.ExtensionMethods.CTisAlphanumeric ( this string  str)
static

Extension method for strings. Checks if the string is alphanumeric.

Parameters
strString-instance.
Returns
True if the string is alphanumeric.

◆ CTIsAlphanumeric()

static bool Crosstales.ExtensionMethods.CTIsAlphanumeric ( this string  str)
static

Extension method for strings. Checks if the string is alphanumeric.

Parameters
strString-instance.
Returns
True if the string is alphanumeric.

◆ CTisCreditcard()

static bool Crosstales.ExtensionMethods.CTisCreditcard ( this string  str)
static

Extension method for strings. Checks if the string is a creditcard.

Parameters
strString-instance.
Returns
True if the string is a creditcard.

◆ CTIsCreditcard()

static bool Crosstales.ExtensionMethods.CTIsCreditcard ( this string  str)
static

Extension method for strings. Checks if the string is a creditcard.

Parameters
strString-instance.
Returns
True if the string is a creditcard.

◆ CTisEmail()

static bool Crosstales.ExtensionMethods.CTisEmail ( this string  str)
static

Extension method for strings. Checks if the string is an email address.

Parameters
strString-instance.
Returns
True if the string is an email address.

◆ CTIsEmail()

static bool Crosstales.ExtensionMethods.CTIsEmail ( this string  str)
static

Extension method for strings. Checks if the string is an email address.

Parameters
strString-instance.
Returns
True if the string is an email address.

◆ CTisInteger()

static bool Crosstales.ExtensionMethods.CTisInteger ( this string  str)
static

Extension method for strings. Checks if the string is integer.

Parameters
strString-instance.
Returns
True if the string is integer.

◆ CTIsInteger()

static bool Crosstales.ExtensionMethods.CTIsInteger ( this string  str)
static

Extension method for strings. Checks if the string is integer.

Parameters
strString-instance.
Returns
True if the string is integer.

◆ CTisIPv4()

static bool Crosstales.ExtensionMethods.CTisIPv4 ( this string  str)
static

Extension method for strings. Checks if the string is an IPv4 address.

Parameters
strString-instance.
Returns
True if the string is an IPv4 address.

◆ CTIsIPv4()

static bool Crosstales.ExtensionMethods.CTIsIPv4 ( this string  str)
static

Extension method for strings. Checks if the string is an IPv4 address.

Parameters
strString-instance.
Returns
True if the string is an IPv4 address.

◆ CTisNumeric()

static bool Crosstales.ExtensionMethods.CTisNumeric ( this string  str)
static

Extension method for strings. Checks if the string is numeric.

Parameters
strString-instance.
Returns
True if the string is numeric.

◆ CTIsNumeric()

static bool Crosstales.ExtensionMethods.CTIsNumeric ( this string  str)
static

Extension method for strings. Checks if the string is numeric.

Parameters
strString-instance.
Returns
True if the string is numeric.

◆ CTIsVisibleFrom()

static bool Crosstales.ExtensionMethods.CTIsVisibleFrom ( this Renderer  renderer,
Camera  camera 
)
static

Extension method for Renderer. Determines if the renderer is visible from a certain camera.

Parameters
rendererRenderer to test the visibility.
cameraCamera for the test.
Returns
True if the renderer is visible by the given camera.

◆ CTisWebsite()

static bool Crosstales.ExtensionMethods.CTisWebsite ( this string  str)
static

Extension method for strings. Checks if the string is a website address.

Parameters
strString-instance.
Returns
True if the string is a website address.

◆ CTIsWebsite()

static bool Crosstales.ExtensionMethods.CTIsWebsite ( this string  str)
static

Extension method for strings. Checks if the string is a website address.

Parameters
strString-instance.
Returns
True if the string is a website address.

◆ CTLastIndexOf()

static int Crosstales.ExtensionMethods.CTLastIndexOf ( this string  str,
string  toCheck,
System.StringComparison  comp = System.StringComparison.OrdinalIgnoreCase 
)
static

Extension method for strings. Returns the index of the last occurence of a given string.

Parameters
strString-instance.
toCheckString for the index.
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
The index of the last occurence of the given string if the string is integer.

◆ CTMultiply() [1/3]

static Vector2 Crosstales.ExtensionMethods.CTMultiply ( this Vector2  a,
Vector2  b 
)
static

Allows you to multiply two Vector2s together, something Unity sorely lacks by default.

Parameters
aFirst vector
bSecond vector
Returns
The ax*bx, ay*by result.

◆ CTMultiply() [2/3]

static Vector3 Crosstales.ExtensionMethods.CTMultiply ( this Vector3  a,
Vector3  b 
)
static

Allows you to multiply two Vector3s together, something Unity sorely lacks by default.

Parameters
aFirst vector
bSecond vector
Returns
The ax*bx, ay*by, az*bz result.

◆ CTMultiply() [3/3]

static Vector4 Crosstales.ExtensionMethods.CTMultiply ( this Vector4  a,
Vector4  b 
)
static

Allows you to multiply two Vector4s together, something Unity sorely lacks by default.

Parameters
aFirst vector
bSecond vector
Returns
The ax*bx, ay*by, az*bz, aw*bw result.

◆ CTQuaternion() [1/2]

static Quaternion Crosstales.ExtensionMethods.CTQuaternion ( this Vector3  eulerAngle)
static

Extension method for Vector3. Convert it to a Quaternion.

Parameters
eulerAngleVector3-instance to convert.
Returns
Quaternion from euler angles.

◆ CTQuaternion() [2/2]

static Quaternion Crosstales.ExtensionMethods.CTQuaternion ( this Vector4  angle)
static

Extension method for Vector4. Convert it to a Quaternion.

Parameters
angleVector4-instance to convert.
Returns
Quaternion from Vector4.

◆ CTReadFully()

static byte [] Crosstales.ExtensionMethods.CTReadFully ( this System.IO.Stream  input)
static

Extension method for Stream. Reads the full content of a Stream.

Parameters
inputStream-instance to read.
Returns
Byte-array of the Stream content.

◆ CTRemoveChars()

static string Crosstales.ExtensionMethods.CTRemoveChars ( this string  str,
params char[]  removeChars 
)
static

Extension method for strings. Removes characters from a string

Parameters
strString-instance.
removeCharsCharacters to remove.
Returns
String without the given characters.

◆ CTRemoveNewLines()

static string Crosstales.ExtensionMethods.CTRemoveNewLines ( this string  str,
string  replacement = "#nl#",
string  newLine = null 
)
static

Extension method for strings. Replaces new lines with a replacement string pattern.

Parameters
strString-instance.
replacementReplacement string pattern (optional, default: "#nl#").
newLineNew line string (optional, default: System.Environment.NewLine).
Returns
Replaced string without new lines.

◆ CTReplace()

static string Crosstales.ExtensionMethods.CTReplace ( this string  str,
string  oldString,
string  newString,
System.StringComparison  comp = System.StringComparison.OrdinalIgnoreCase 
)
static

Extension method for strings. Default: case insensitive 'Replace'.

Parameters
strString-instance.
oldStringString to replace.
newStringNew replacement string.
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
Replaced string.

◆ CTReverse()

static string Crosstales.ExtensionMethods.CTReverse ( this string  str)
static

Extension method for strings. Reverses a string.

Parameters
strString-instance.
Returns
Reversed string.

◆ CTRotate180()

static Texture2D Crosstales.ExtensionMethods.CTRotate180 ( this Texture2D  texture)
static

Extension method for Texture. Rotates a Texture by 180 degrees.

Parameters
textureTexture to rotate.
Returns
Rotated Texture.

◆ CTRotate270()

static Texture2D Crosstales.ExtensionMethods.CTRotate270 ( this Texture2D  texture)
static

Extension method for Texture. Rotates a Texture by 270 degrees.

Parameters
textureTexture to rotate.
Returns
Rotated Texture.

◆ CTRotate90()

static Texture2D Crosstales.ExtensionMethods.CTRotate90 ( this Texture2D  texture)
static

Extension method for Texture. Rotates a Texture by 90 degrees.

Parameters
textureTexture to rotate.
Returns
Rotated Texture.

◆ CTSetBottom()

static void Crosstales.ExtensionMethods.CTSetBottom ( this RectTransform  transform,
float  value 
)
static

Extension method for RectTransform. Sets the Bottom-property of a RectTransform.

Parameters
transformRectTransform to set the Bottom-property.
valueValue for the Bottom-property.

◆ CTSetLeft()

static void Crosstales.ExtensionMethods.CTSetLeft ( this RectTransform  transform,
float  value 
)
static

Extension method for RectTransform. Sets the Left-property of a RectTransform.

Parameters
transformRectTransform to set the Left-property.
valueValue for the Left-property.

◆ CTSetLRTB()

static void Crosstales.ExtensionMethods.CTSetLRTB ( this RectTransform  transform,
Vector4  lrtb 
)
static

Extension method for RectTransform. Sets the Left/Right/Top/Bottom-properties of a RectTransform.

Parameters
transformRectTransform to set the Left/Right/Top/Bottom-properties.
lrtbLeft/Right/Top/Bottom-properties as Vector4.

◆ CTSetRight()

static void Crosstales.ExtensionMethods.CTSetRight ( this RectTransform  transform,
float  value 
)
static

Extension method for RectTransform. Sets the Right-property of a RectTransform.

Parameters
transformRectTransform to set the Right-property.
valueValue for the Right-property.

◆ CTSetTop()

static void Crosstales.ExtensionMethods.CTSetTop ( this RectTransform  transform,
float  value 
)
static

Extension method for RectTransform. Sets the Top-property of a RectTransform.

Parameters
transformRectTransform to set the Top-property.
valueValue for the Top-property.

◆ CTShuffle< T >() [1/2]

static void Crosstales.ExtensionMethods.CTShuffle< T > ( this System.Collections.Generic.IList< T >  list,
int  seed = 0 
)
static

Extension method for IList. Shuffles a List.

Parameters
listIList-instance to shuffle.
seedSeed for the PRNG (optional, default: 0 (=standard))

◆ CTShuffle< T >() [2/2]

static void Crosstales.ExtensionMethods.CTShuffle< T > ( this T[]  array,
int  seed = 0 
)
static

Extension method for arrays. Shuffles an array.

Parameters
arrayArray-instance to shuffle.
seedSeed for the PRNG (optional, default: 0 (=standard))

◆ CTStartsWith()

static bool Crosstales.ExtensionMethods.CTStartsWith ( this string  str,
string  toCheck,
System.StringComparison  comp = System.StringComparison.OrdinalIgnoreCase 
)
static

Extension method for strings. Checks if the string starts with another string.

Parameters
strString-instance.
toCheckString to check.
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
True if the string is integer.

◆ CTToBase64() [1/2]

static string Crosstales.ExtensionMethods.CTToBase64 ( this byte[]  data)
static

Extension method for byte-arrays. Converts a byte-array to a Base64-string.

Parameters
dataInput as byte-array.
Returns
Base64-string from the byte-array.

◆ CTToBase64() [2/2]

static string Crosstales.ExtensionMethods.CTToBase64 ( this string  str,
System.Text.Encoding  encoding = null 
)
static

Extension method for strings. Converts the value of a string to a Base64-string.

Parameters
strInput string.
encodingEncoding of the string (optional, default: UTF8).
Returns
String value as converted Base64-string.

◆ CTToByteArray() [1/2]

static byte [] Crosstales.ExtensionMethods.CTToByteArray ( this float[]  array,
int  count = 0 
)
static

Extension method for float-arrays. Converts a float-array to a byte-array.

Parameters
arrayArray-instance to convert.
countNumber of floats to convert (optional).
Returns
Converted byte-array.

◆ CTToByteArray() [2/2]

static byte [] Crosstales.ExtensionMethods.CTToByteArray ( this string  str,
System.Text.Encoding  encoding = null 
)
static

Extension method for strings. Converts the value of a string to a byte-array.

Parameters
strInput string.
encodingEncoding of the string (optional, default: UTF8).
Returns
Byte-array with the string.

◆ CTToEXR() [1/2]

static byte [] Crosstales.ExtensionMethods.CTToEXR ( this Sprite  sprite)
static

Extension method for Sprite. Converts a Sprite to a EXR byte-array.

Parameters
spriteSprite to convert.
Returns
Converted Sprite as EXR byte-array.

◆ CTToEXR() [2/2]

static byte [] Crosstales.ExtensionMethods.CTToEXR ( this Texture2D  texture)
static

Extension method for Texture. Converts a Texture to a EXR byte-array.

Parameters
textureTexture to convert.
Returns
Converted Texture as EXR byte-array.

◆ CTToFloatArray()

static float [] Crosstales.ExtensionMethods.CTToFloatArray ( this byte[]  array,
int  count = 0 
)
static

Extension method for byte-arrays. Converts a byte-array to a float-array.

Parameters
arrayArray-instance to convert.
countNumber of bytes to convert (optional).
Returns
Converted float-array.

◆ CTToHex()

static string Crosstales.ExtensionMethods.CTToHex ( this string  str,
bool  addPrefix = false 
)
static

Extension method for strings. Converts the value of a string to a Hex-string (with Unicode support).

Parameters
strInput string.
addPrefixAdd "0x"-as prefix (optional, default: false).
Returns
String value as converted Hex-string.

◆ CTToHexRGB() [1/2]

static string Crosstales.ExtensionMethods.CTToHexRGB ( this Color  input)
static

Extension method for Color. Converts the value of a color to a RGB Hex-string.

Parameters
inputColor to convert.
Returns
Color value as Hex (format "RRGGBB").

◆ CTToHexRGB() [2/2]

static string Crosstales.ExtensionMethods.CTToHexRGB ( this Color32  input)
static

Extension method for Color32. Converts the value of a color to a RGB Hex-string.

Parameters
inputColor to convert.
Returns
Color value as Hex (format "RRGGBB").

◆ CTToHexRGBA() [1/2]

static string Crosstales.ExtensionMethods.CTToHexRGBA ( this Color  input)
static

Extension method for Color. Converts the value of a color to a RGBA Hex-string.

Parameters
inputColor to convert.
Returns
Color value as Hex (format "RRGGBBAA").

◆ CTToHexRGBA() [2/2]

static string Crosstales.ExtensionMethods.CTToHexRGBA ( this Color32  input)
static

Extension method for Color32. Converts the value of a color to a RGBA Hex-string.

Parameters
inputColor to convert.
Returns
Color value as Hex (format "RRGGBBAA").

◆ CTToJPG() [1/2]

static byte [] Crosstales.ExtensionMethods.CTToJPG ( this Sprite  sprite)
static

Extension method for Sprite. Converts a Sprite to a JPG byte-array.

Parameters
spriteSprite to convert.
Returns
Converted Sprite as JPG byte-array.

◆ CTToJPG() [2/2]

static byte [] Crosstales.ExtensionMethods.CTToJPG ( this Texture2D  texture)
static

Extension method for Texture. Converts a Texture to a JPG byte-array.

Parameters
textureTexture to convert.
Returns
Converted Texture as JPG byte-array.

◆ CTToPNG() [1/2]

static byte [] Crosstales.ExtensionMethods.CTToPNG ( this Sprite  sprite)
static

Extension method for Sprite. Converts a Sprite to a PNG byte-array.

Parameters
spriteSprite to convert.
Returns
Converted Sprite as PNG byte-array.

◆ CTToPNG() [2/2]

static byte [] Crosstales.ExtensionMethods.CTToPNG ( this Texture2D  texture)
static

Extension method for Texture. Converts a Texture to a PNG byte-array.

Parameters
textureTexture to convert.
Returns
Converted Texture as PNG byte-array.

◆ CTToSprite() [1/2]

static Sprite Crosstales.ExtensionMethods.CTToSprite ( this byte[]  data,
Texture2D  supportTexture = null 
)
static

Extension method for byte-arrays. Converts a byte-array to a Sprite. Supported image formats: PNG and JPG.

Parameters
databyte-array-instance to convert.
supportTextureSupport texture to prevent possible texture garbage (optional).
Returns
Converted Sprite.

◆ CTToSprite() [2/2]

static Sprite Crosstales.ExtensionMethods.CTToSprite ( this Texture2D  texture,
float  pixelsPerUnit = 100f 
)
static

Extension method for Texture. Converts a Texture to a Sprite.

Parameters
textureTexture to convert.
pixelsPerUnitPixels per unit for the Sprite (optional, default: 100).
Returns
Converted Texture as Sprite.

◆ CTToString()

static string Crosstales.ExtensionMethods.CTToString ( this byte[]  data,
System.Text.Encoding  encoding = null 
)
static

Extension method for byte-arrays. Converts a byte-array to a string.

Parameters
dataInput string as byte-array.
encodingEncoding of the string (optional, default: UTF8).
Returns
Byte-array with the string.

◆ CTToString< T >()

static System.Collections.Generic.List<string> Crosstales.ExtensionMethods.CTToString< T > ( this System.Collections.Generic.IList< T >  list)
static

Extension method for IList. Generates a string list with all entries (via ToString).

Parameters
listIList-instance to ToString.
Returns
String list with all entries (via ToString).

◆ CTToStringArray< T >()

static string [] Crosstales.ExtensionMethods.CTToStringArray< T > ( this T[]  array)
static

Extension method for arrays. Generates a string array with all entries (via ToString).

Parameters
arrayArray-instance to ToString.
Returns
String array with all entries (via ToString).

◆ CTToTexture()

static Texture2D Crosstales.ExtensionMethods.CTToTexture ( this byte[]  data,
Texture2D  supportTexture = null 
)
static

Extension method for byte-arrays. Converts a byte-array to a Texture. Supported image formats: PNG and JPG.

Parameters
databyte-array-instance to convert.
supportTextureSupport texture to prevent possible texture garbage (optional).
Returns
Converted Texture.

◆ CTToTexture2D() [1/2]

static Texture2D Crosstales.ExtensionMethods.CTToTexture2D ( this Texture  texture)
static

Extension method for Texture. Convert a Texture to a Texture2D

Parameters
textureTexture to convert.
Returns
Converted Texture2D.

◆ CTToTexture2D() [2/2]

static Texture2D Crosstales.ExtensionMethods.CTToTexture2D ( this WebCamTexture  texture)
static

Extension method for WebCamTexture. Convert a WebCamTexture to a Texture2D

Parameters
textureWebCamTexture to convert.
Returns
Converted Texture2D.

◆ CTToTGA() [1/2]

static byte [] Crosstales.ExtensionMethods.CTToTGA ( this Sprite  sprite)
static

Extension method for Sprite. Converts a Sprite to a TGA byte-array.

Parameters
spriteSprite to convert.
Returns
Converted Sprite as TGA byte-array.

◆ CTToTGA() [2/2]

static byte [] Crosstales.ExtensionMethods.CTToTGA ( this Texture2D  texture)
static

Extension method for Texture. Converts a Texture to a TGA byte-array.

Parameters
textureTexture to convert.
Returns
Converted Texture as TGA byte-array.

◆ CTToTitleCase()

static string Crosstales.ExtensionMethods.CTToTitleCase ( this string  str)
static

Extension method for strings. Converts a string to title case (first letter uppercase).

Parameters
strString-instance.
Returns
Converted string in title case.

◆ CTVector3() [1/3]

static Vector3 Crosstales.ExtensionMethods.CTVector3 ( this Color  color)
static

Extension method for Color. Convert it to a Vector3.

Parameters
colorColor-instance to convert.
Returns
Vector3 from color.

◆ CTVector3() [2/3]

static Vector3 Crosstales.ExtensionMethods.CTVector3 ( this Color32  color)
static

Extension method for Color32. Convert it to a Vector3.

Parameters
colorColor-instance to convert.
Returns
Vector3 from color.

◆ CTVector3() [3/3]

static Vector3 Crosstales.ExtensionMethods.CTVector3 ( this Quaternion  angle)
static

Extension method for Quaternion. Convert it to a Vector3.

Parameters
angleQuaternion-instance to convert.
Returns
Vector3 from Quaternion.

◆ CTVector4() [1/3]

static Vector4 Crosstales.ExtensionMethods.CTVector4 ( this Color  color)
static

Extension method for Color. Convert it to a Vector4.

Parameters
colorColor-instance to convert.
Returns
Vector4 from color.

◆ CTVector4() [2/3]

static Vector4 Crosstales.ExtensionMethods.CTVector4 ( this Color32  color)
static

Extension method for Color32. Convert it to a Vector4.

Parameters
colorColor-instance to convert.
Returns
Vector4 from color.

◆ CTVector4() [3/3]

static Vector4 Crosstales.ExtensionMethods.CTVector4 ( this Quaternion  angle)
static

Extension method for Quaternion. Convert it to a Vector4.

Parameters
angleQuaternion-instance to convert.
Returns
Vector4 from Quaternion.

◆ GetColumn< T >()

static T [] Crosstales.ExtensionMethods.GetColumn< T > ( this T  matrix[,],
int  columnNumber 
)
static

Extension method for 2D-arrays. Returns the column of a 2D-array as array.

Parameters
matrixInput as 2D-array.
columnNumberDesired column of the 2D-array
Returns
Column of a 2D-array as array.

◆ GetRow< T >()

static T [] Crosstales.ExtensionMethods.GetRow< T > ( this T  matrix[,],
int  rowNumber 
)
static

Extension method for 2D-arrays. Returns the row of a 2D-array as array.

Parameters
matrixInput as 2D-array.
columnNumberDesired row of the 2D-array
Returns
Row of a 2D-array as array.

The documentation for this class was generated from the following file:
  • C:/Users/slaub/Unity/assets/RTVoice/RTVoicePro/Assets/Plugins/crosstales/Common/Scripts/ExtensionMethods.cs