ORK Framework  2.26.1
API Documentation
ORKFramework.DataObject Class Reference

Used to handle data from IBaseData objects for XML serialization. Supported types: More...

Public Member Functions

 DataObject ()
 Initializes a new instance of a ORKFramework.DataObject. More...
 
bool Contains< T > (string key)
 Determines if the data object contains the specified key for a data type. More...
 
bool ContainsArray< T > (string key)
 Determines if the data object contains the specified key for an array of a a data type. More...
 
void Set< T > (string key, T value)
 Assign a value to a key. Enum types are converted to integers. More...
 
void Get< T > (string key, ref T value)
 Get the value assigned to a key. More...
 
Dictionary< string, T > GetData< T > (System.Type type)
 Gets a list containing keys and values of a type. More...
 
void SetData< T > (Dictionary< string, T > data, System.Type type)
 Sets a list containing keys and values of a type. More...
 
void Set< T > (string key, T[] value)
 Assign an array to a key. Enum arrays are used as integer arrays. More...
 
bool Get< T > (string key, out T[] value)
 Get the array assigned to a key. More...
 
Dictionary< string, T[]> GetArrayData< T > (System.Type type)
 Gets a list containing keys and values of an array type. More...
 
void SetArrayData< T > (Dictionary< string, T[]> data, System.Type type)
 Sets a list containing keys and values of an array type. More...
 
DataObject GetFile (string key)
 Gets the ORKFramework.DataObject assigned to a key. More...
 
DataObject [] GetFileArray (string key)
 Gets the ORKFramework.DataObject array assigned to a key. More...
 
ORKDataFile GetDataFile (string name, bool encrypt)
 Returns the ORKFramework.DataObject data in a XML formatted string. More...
 

Detailed Description

Used to handle data from IBaseData objects for XML serialization. Supported types:

  • int, float, bool, string
  • int[], float[], bool[], string[]
  • enum is used as int
  • enum[] is used as int[]
  • Vector2, Vector2[], Vector3, Vector3[], Vector4, Vector4[], Rect, Rect[] are used as float[].

Constructor & Destructor Documentation

◆ DataObject()

ORKFramework.DataObject.DataObject ( )

Initializes a new instance of a ORKFramework.DataObject.

Parameters
nameThe node name of the XML file.

Member Function Documentation

◆ Contains< T >()

bool ORKFramework.DataObject.Contains< T > ( string  key)

Determines if the data object contains the specified key for a data type.

Returns
true if the data object contains the key; otherwise false.
Parameters
keyThe key.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, ORKFramework.DataObject.

◆ ContainsArray< T >()

bool ORKFramework.DataObject.ContainsArray< T > ( string  key)

Determines if the data object contains the specified key for an array of a a data type.

Returns
true if the data object contains the key; otherwise false.
Parameters
keyThe key.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, ORKFramework.DataObject.

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

void ORKFramework.DataObject.Get< T > ( string  key,
ref T  value 
)

Get the value assigned to a key.

Parameters
keyThe key to look for.
valueThe reference to the variable holding the value. If the key is found the value is stored in this variable.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, ORKFramework.DataObject.

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

bool ORKFramework.DataObject.Get< T > ( string  key,
out T []  value 
)

Get the array assigned to a key.

Parameters
keyThe key to look for.
valueThe reference to the array holding the value. If the key is found the array is copied into this variable. Else an array with length 0 will be assigned.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, ORKFramework.DataObject.

◆ GetArrayData< T >()

Dictionary<string, T[]> ORKFramework.DataObject.GetArrayData< T > ( System.Type  type)

Gets a list containing keys and values of an array type.

Returns
A Dictionary<string, T[]> containing keys (string) and array values (T[]).
Parameters
typeThe data type (System.Type).
Template Parameters
TThe generic data type.

◆ GetData< T >()

Dictionary<string, T> ORKFramework.DataObject.GetData< T > ( System.Type  type)

Gets a list containing keys and values of a type.

Returns
A Dictionary<string, T> containing keys (string) and values (T).
Parameters
typeThe data type (System.Type).
Template Parameters
TThe generic data type.

◆ GetDataFile()

ORKDataFile ORKFramework.DataObject.GetDataFile ( string  name,
bool  encrypt 
)

Returns the ORKFramework.DataObject data in a XML formatted string.

Parameters
nameThe name of the XML root node.
encryptThe XML data will be encrypted.
Returns
An ORKFramework.ORKDataFile that represents the current data of the ORKFramework.DataObject.

◆ GetFile()

DataObject ORKFramework.DataObject.GetFile ( string  key)

Gets the ORKFramework.DataObject assigned to a key.

Returns
The ORKFramework.DataObject if the key is found. Returns null if the key isn't found.
Parameters
keyThe key to look for.

◆ GetFileArray()

DataObject [] ORKFramework.DataObject.GetFileArray ( string  key)

Gets the ORKFramework.DataObject array assigned to a key.

Returns
The ORKFramework.DataObject array if the key is found. Returns an array with length 0 if the key isn't found.
Parameters
keyThe key to look for.

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

void ORKFramework.DataObject.Set< T > ( string  key,
value 
)

Assign a value to a key. Enum types are converted to integers.

Parameters
keyThe key the value will be assigned to.
valueThe value that will be assigned.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, ORKFramework.DataObject.

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

void ORKFramework.DataObject.Set< T > ( string  key,
T []  value 
)

Assign an array to a key. Enum arrays are used as integer arrays.

Parameters
keyThe key the array will be assigned to.
valueThe array that will be assigned.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, ORKFramework.DataObject.

◆ SetArrayData< T >()

void ORKFramework.DataObject.SetArrayData< T > ( Dictionary< string, T[]>  data,
System.Type  type 
)

Sets a list containing keys and values of an array type.

Parameters
dataA Dictionary<string, T[]> containing keys (string) and array values (T[]).
typeThe data type (System.Type).
Template Parameters
TThe generic data type.

◆ SetData< T >()

void ORKFramework.DataObject.SetData< T > ( Dictionary< string, T >  data,
System.Type  type 
)

Sets a list containing keys and values of a type.

Parameters
dataA Dictionary<string, T> containing keys (string) and values (T).
typeThe data type (System.Type).
Template Parameters
TThe generic data type.