Watson Developer Cloud Unity SDK  1.0.0
The Unity SDK uses the Watson Developer Cloud services, a collection of REST APIs and SDKs that use cognitive computing to solve complex problems.
IBM.Watson.DeveloperCloud.Utilities.Utility Class Reference

Utility functions. More...

Public Member Functions

delegate void OnGetToken (AuthenticationToken authenticationToken, string data)
 The OnGetToken callback. More...
 

Static Public Member Functions

static Type[] FindAllDerivedTypes (Type type)
 This helper functions returns all Type's that inherit from the given type. More...
 
static bool Approximately (double a, double b, double tolerance=0.0001)
 Approximately the specified a, b and tolerance. More...
 
static bool Approximately (float a, float b, float tolerance=0.0001f)
 Approximately the specified a, b and tolerance. More...
 
static bool Approximately (Vector3 a, Vector3 b, float tolerance=0.0001f)
 Approximately the specified a, b and tolerance. More...
 
static bool Approximately (Quaternion a, Quaternion b, float tolerance=0.0001f)
 Approximately Quaternion with the specified a, b and tolerance. More...
 
static GameObject FindObject (GameObject parent, string nameChild)
 Finds the object in child of parent object by name of child More...
 
static T[] FindObjects< T > (GameObject parent, string nameChild, bool isContains=false, bool sortByName=false, bool includeInactive=true)
 Finds the objects in children of parent object by name of child More...
 
static string GetMD5 (string s)
 Get the MD5 hash of a string. More...
 
static string RemoveTags (string s, char tagStartChar= '<', char tagEndChar= '>')
 Removes any tags from a string. (e.g. <title></title>) More...
 
static string GetOnOffString (bool b)
 Gets the on off string. More...
 
static string StripString (string s)
 Strips the prepending ! statment from string. More...
 
static double GetEpochUTCMilliseconds ()
 Gets the EPOCH time in UTC time zome More...
 
static double GetEpochUTCSeconds ()
 Gets the epoch UTC seconds. More...
 
static DateTime GetLocalDateTimeFromEpoch (double epochTime)
 Gets the date time from epoch. More...
 
static byte[] Color32ArrayToByteArray (Color32[] colors)
 Converts Color32 array to Byte array. More...
 
static T DeserializeResponse< T > (byte[] resp, object obj=null)
 Deserializes the response. More...
 
static T DeserializeResponse< T > (string json, object obj=null)
 Deserializes the response. More...
 
static string AddTopLevelObjectToJson (string json, string objectName)
 Hack to add a top level object to a json string because Unity does not like top level collections. More...
 
static string GetMimeType (string extension)
 
static string GetExtension (string mimeType)
 
static bool GetToken (OnGetToken callback, string serviceEndpoint, string username, string password, string tokenName="")
 Gets a token to authenticate serivce calls instead of using username and password. More...
 

Properties

static string MacAddress [get]
 Returns First valid Mac address of the local machine More...
 

Detailed Description

Utility functions.

Member Function Documentation

static string IBM.Watson.DeveloperCloud.Utilities.Utility.AddTopLevelObjectToJson ( string  json,
string  objectName 
)
inlinestatic

Hack to add a top level object to a json string because Unity does not like top level collections.

Parameters
jsonThe json string.
objectNameThe name of the top level object.
Returns
static bool IBM.Watson.DeveloperCloud.Utilities.Utility.Approximately ( double  a,
double  b,
double  tolerance = 0.0001 
)
inlinestatic

Approximately the specified a, b and tolerance.

Parameters
aThe first component.
bThe second component.
toleranceTolerance.
static bool IBM.Watson.DeveloperCloud.Utilities.Utility.Approximately ( float  a,
float  b,
float  tolerance = 0.0001f 
)
inlinestatic

Approximately the specified a, b and tolerance.

Parameters
aThe first component.
bThe second component.
toleranceTolerance.
static bool IBM.Watson.DeveloperCloud.Utilities.Utility.Approximately ( Vector3  a,
Vector3  b,
float  tolerance = 0.0001f 
)
inlinestatic

Approximately the specified a, b and tolerance.

Parameters
aThe first component.
bThe second component.
toleranceTolerance.
static bool IBM.Watson.DeveloperCloud.Utilities.Utility.Approximately ( Quaternion  a,
Quaternion  b,
float  tolerance = 0.0001f 
)
inlinestatic

Approximately Quaternion with the specified a, b and tolerance.

Parameters
aThe first component.
bThe second component.
toleranceTolerance.
static byte [] IBM.Watson.DeveloperCloud.Utilities.Utility.Color32ArrayToByteArray ( Color32[]  colors)
inlinestatic

Converts Color32 array to Byte array.

Parameters
colorsColor32 array of the image.
Returns
static T IBM.Watson.DeveloperCloud.Utilities.Utility.DeserializeResponse< T > ( byte[]  resp,
object  obj = null 
)
inlinestatic

Deserializes the response.

Returns
The response.
Parameters
respResp.
objObject.
Template Parameters
TThe 1st type parameter.
Type Constraints
T :class 
T :new() 
static T IBM.Watson.DeveloperCloud.Utilities.Utility.DeserializeResponse< T > ( string  json,
object  obj = null 
)
inlinestatic

Deserializes the response.

Returns
The response.
Parameters
jsonJson string of object
objObject.
Template Parameters
TThe 1st type parameter.
Type Constraints
T :class 
T :new() 
static Type [] IBM.Watson.DeveloperCloud.Utilities.Utility.FindAllDerivedTypes ( Type  type)
inlinestatic

This helper functions returns all Type's that inherit from the given type.

Parameters
typeThe Type to find all types that inherit from the given type.
Returns
A array of all Types that inherit from type.
static GameObject IBM.Watson.DeveloperCloud.Utilities.Utility.FindObject ( GameObject  parent,
string  nameChild 
)
inlinestatic

Finds the object in child of parent object by name of child

Returns
The object.
Parameters
parentParent Object.
nameChildName child.
static T [] IBM.Watson.DeveloperCloud.Utilities.Utility.FindObjects< T > ( GameObject  parent,
string  nameChild,
bool  isContains = false,
bool  sortByName = false,
bool  includeInactive = true 
)
inlinestatic

Finds the objects in children of parent object by name of child

Returns
The objects.
Parameters
parentParent.
nameChildName child.
isContainsCheck string contains the name instead of equality.
sortByNameIf true, children will be returned sorted by their name.
Type Constraints
T :Component 
static double IBM.Watson.DeveloperCloud.Utilities.Utility.GetEpochUTCMilliseconds ( )
inlinestatic

Gets the EPOCH time in UTC time zome

Returns
Double EPOCH in UTC
static double IBM.Watson.DeveloperCloud.Utilities.Utility.GetEpochUTCSeconds ( )
inlinestatic

Gets the epoch UTC seconds.

Returns
The epoch UTC seconds.
static string IBM.Watson.DeveloperCloud.Utilities.Utility.GetExtension ( string  mimeType)
inlinestatic
static DateTime IBM.Watson.DeveloperCloud.Utilities.Utility.GetLocalDateTimeFromEpoch ( double  epochTime)
inlinestatic

Gets the date time from epoch.

Returns
The date time from epoch.
Parameters
epochTimeEpoch time.
kindKind.
static string IBM.Watson.DeveloperCloud.Utilities.Utility.GetMD5 ( string  s)
inlinestatic

Get the MD5 hash of a string.

Parameters
s
Returns
static string IBM.Watson.DeveloperCloud.Utilities.Utility.GetMimeType ( string  extension)
inlinestatic
static string IBM.Watson.DeveloperCloud.Utilities.Utility.GetOnOffString ( bool  b)
inlinestatic

Gets the on off string.

Returns
The on off string.
Parameters
bIf set to true b.
static bool IBM.Watson.DeveloperCloud.Utilities.Utility.GetToken ( OnGetToken  callback,
string  serviceEndpoint,
string  username,
string  password,
string  tokenName = "" 
)
inlinestatic

Gets a token to authenticate serivce calls instead of using username and password.

Parameters
callbackThe OnGetToken callback,
serviceEndpointThe service endpoint.
usernameThe service username.
passwordThe service password.
tokenNameA user defined name for the token.
Returns
True if the call succeeds.
delegate void IBM.Watson.DeveloperCloud.Utilities.Utility.OnGetToken ( AuthenticationToken  authenticationToken,
string  data 
)

The OnGetToken callback.

Parameters
authenticationTokenThe authentication token object.
dataUser defined custom data.
static string IBM.Watson.DeveloperCloud.Utilities.Utility.RemoveTags ( string  s,
char  tagStartChar = '<',
char  tagEndChar = '>' 
)
inlinestatic

Removes any tags from a string. (e.g. <title></title>)

Parameters
s
Returns
static string IBM.Watson.DeveloperCloud.Utilities.Utility.StripString ( string  s)
inlinestatic

Strips the prepending ! statment from string.

Returns
The string.
Parameters
sS.

Property Documentation

string IBM.Watson.DeveloperCloud.Utilities.Utility.MacAddress
staticget

Returns First valid Mac address of the local machine


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