Class ExtendedInfoHelper
This class extends Extendable in order to help with dealing with ExtendedInfo data
Inherited Members
Namespace: Xareus.Scenarios.Extra
Assembly: Xareus.Scenarios.Extra.dll
Syntax
public static class ExtendedInfoHelper
Methods
AddExtendedInfoElementArrayValue<T>(Extendable, string, string, string, T)
Add an entry in the given XML element at the given path in the given root XML element. The root XML element and the XML Elements are created if not found
Declaration
public static void AddExtendedInfoElementArrayValue<T>(this Extendable extendable, string rootElementName, string path, string xmlElementName, T value)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | The path to the parent of the XML element to set |
string | xmlElementName | The name of the XML element to set |
T | value | The value of the XML element |
Type Parameters
Name | Description |
---|---|
T | The type of data to set |
GetExtendedInfoAttributeValue<T>(Extendable, string, string, string, T)
Get the attribute value in the given rootElement and at the given path in the ExentdedInfo of the extendable
Declaration
public static T GetExtendedInfoAttributeValue<T>(this Extendable extendable, string rootElementName, string xpath, string attribute, T defaultValue = default)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing the value in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | xpath | The xpath to the value. Do not use @ in the xpath |
string | attribute | The name of the attribute in the xpath containing the value |
T | defaultValue | The value to return if the value could not be found in the ExtendedInfo. (default : default(T)) |
Returns
Type | Description |
---|---|
T | The value if found. The default value otherwise |
Type Parameters
Name | Description |
---|---|
T | The type of data to return |
GetExtendedInfoElementArrayCount(Extendable, string, string, string)
Get the number of entries in the given XML element at the given path in the given root XML element.
Declaration
public static int GetExtendedInfoElementArrayCount(this Extendable extendable, string rootElementName, string path, string xmlElementName)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | The path to the parent of the XML element to get the number of children of |
string | xmlElementName | The name of the XML element to get the number of children of |
Returns
Type | Description |
---|---|
int |
GetExtendedInfoElementArray<T>(Extendable, string, string, string, int)
Get the value of the given entry in the given XML element at the given path in the given root XML element.
Declaration
public static T GetExtendedInfoElementArray<T>(this Extendable extendable, string rootElementName, string path, string xmlElementName, int index)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | The path to the parent of the XML element to get the number of children of |
string | xmlElementName | The name of the XML element to get the number of children of |
int | index | The Id of the element to get in the array |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | The type of data to set |
GetExtendedInfoRoot(Extendable, string)
Get (or create if not found) the root XmlElement with the given name in the extendable's ExtendedInfo
Declaration
public static XmlElement GetExtendedInfoRoot(this Extendable extendable, string rootElementName)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing the root XML Element in its ExtendedInfo |
string | rootElementName | The name of the root XML element to get |
Returns
Type | Description |
---|---|
XmlElement | The specified root XmlElement. |
GetExtendedInfoValue<T>(Extendable, string, string, T)
Get the value in the given rootElement and at the given path in the ExentdedInfo of the extendable
Declaration
public static T GetExtendedInfoValue<T>(this Extendable extendable, string rootElementName, string xpath, T defaultValue = default)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing the value in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | xpath | The xpath to the value |
T | defaultValue | The value to return if the value could not be found in the ExtendedInfo. (default : default(T)) |
Returns
Type | Description |
---|---|
T | The value if found. The default value otherwise |
Type Parameters
Name | Description |
---|---|
T | The type of data to return |
HasExtendedInfoElement(Extendable, string, string, string)
Check if the XML element value at the given path in the given root XML element exists.
Declaration
public static bool HasExtendedInfoElement(this Extendable extendable, string rootElementName, string path, string xmlElementName)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | The path to the parent of the XML element to check |
string | xmlElementName | The name of the XML element to check |
Returns
Type | Description |
---|---|
bool | True if the value was found, false otherwise |
HasExtendedInfoRoot(Extendable, string)
Check if a root XmlElement with the given name exists in the extendable's ExtendedInfo
Declaration
public static bool HasExtendedInfoRoot(this Extendable extendable, string rootElementName)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing the root XML Element in its ExtendedInfo |
string | rootElementName | The name of the root XML element to get |
Returns
Type | Description |
---|---|
bool | True if the root element was found, false otherwise |
RemoveExtendedInfoElement(Extendable, string, string, string)
Removes XML element at the given path in the given root XML element if it exists.
Declaration
public static void RemoveExtendedInfoElement(this Extendable extendable, string rootElementName, string path, string xmlElementName)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | The path to the parent of the XML element to remove |
string | xmlElementName | The name of the XML element to remove |
RemoveExtendedInfoElementArrayValue(Extendable, string, string, string, int)
Removes the given entry of the XML element array value at the given path in the given root XML element.
Declaration
public static void RemoveExtendedInfoElementArrayValue(this Extendable extendable, string rootElementName, string path, string xmlElementName, int index)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | The path to the parent of the XML element to set |
string | xmlElementName | The name of the XML element to set |
int | index | The id of the element to set |
RemoveExtendedInfoRoot(Extendable, string)
Remove (if it exists) the root XmlElement with the given name in the extendable's ExtendedInfo
Declaration
public static void RemoveExtendedInfoRoot(this Extendable extendable, string rootElementName)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing the root XML Element in its ExtendedInfo |
string | rootElementName | The name of the root XML element to remove |
RenameExtendedInfoRoot(Extendable, string, string)
Get (or create if not found) the root XmlElement with the given name in the extendable's ExtendedInfo
Declaration
public static void RenameExtendedInfoRoot(this Extendable extendable, string rootElementName, string newRootElementName)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing the root XML Element in its ExtendedInfo |
string | rootElementName | The name of the root XML element to get |
string | newRootElementName |
SetExtendedInfoAttributeValue<T>(Extendable, string, string, string, T)
Set (create if it doesn't exist) the attribute value at the given path of the given root XML element. The root XML element and XML elements in the path are created if necessary
Declaration
public static void SetExtendedInfoAttributeValue<T>(this Extendable extendable, string rootElementName, string path, string xmlAttributeName, T value)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | Thet path to the XML element that will get its attribute set |
string | xmlAttributeName | The name of the attribute to set |
T | value | The value of the attribute |
Type Parameters
Name | Description |
---|---|
T | The type of data to set |
SetExtendedInfoAttributeValue<T>(Extendable, string, string, T)
Set (create if it doesn't exist) the attribute value of the given root XML element. The root XML element is created if not found
Declaration
public static void SetExtendedInfoAttributeValue<T>(this Extendable extendable, string rootElementName, string xmlAttributeName, T value)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | xmlAttributeName | The name of the attribute to set |
T | value | The value of the attribute |
Type Parameters
Name | Description |
---|---|
T | The type of data to set |
SetExtendedInfoElementArrayValue<T>(Extendable, string, string, string, T, int)
Set the value of the given entry of the XML element at the given path in the given root XML element. The entry id must already exist
Declaration
public static void SetExtendedInfoElementArrayValue<T>(this Extendable extendable, string rootElementName, string path, string xmlElementName, T value, int index)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | The path to the parent of the XML element to set |
string | xmlElementName | The name of the XML element to set |
T | value | The value of the XML element |
int | index | The id of the element to set |
Type Parameters
Name | Description |
---|---|
T | The type of data to set |
SetExtendedInfoElementValue<T>(Extendable, string, string, string, T)
Set (create if it doesn't exist) the XML element value at the given path in the given root XML element. The root XML element and the XML Elements are created if not found
Declaration
public static void SetExtendedInfoElementValue<T>(this Extendable extendable, string rootElementName, string path, string xmlElementName, T value)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | path | The path to the parent of the XML element to set |
string | xmlElementName | The name of the XML element to set |
T | value | The value of the XML element |
Type Parameters
Name | Description |
---|---|
T | The type of data to set |
SetExtendedInfoElementValue<T>(Extendable, string, string, T)
Set (create if it doesn't exist) the XML element value in the given root XML element. The root XML element and the XML Element are created if not found
Declaration
public static void SetExtendedInfoElementValue<T>(this Extendable extendable, string rootElementName, string xmlElementName, T value)
Parameters
Type | Name | Description |
---|---|---|
Extendable | extendable | The extendable containing xmlRootElement in its ExtendedInfo |
string | rootElementName | The name of the root XML element to use |
string | xmlElementName | The name of the XML element to set |
T | value | The value of the XML element |
Type Parameters
Name | Description |
---|---|
T | The type of data to set |