Class ConfigurationSerializer<T>
Implements IConfigurationTransformer<TOutput> by serializing the syntax tree into some string or binary format.
Implements
Inherited Members
Namespace: Snowflake.Configuration.Serialization.Serializers
Assembly: Snowflake.Framework.dll
Syntax
public abstract class ConfigurationSerializer<T> : IConfigurationTransformer<T>
Type Parameters
| Name | Description |
|---|---|
| T | The type of the serialized data after traversing the tree. |
Methods
SerializeBlockBegin(IConfigurationSerializationContext<T>, Int32)
Serialize a marker or header where a block or section begins in the serialized stream.
Declaration
public abstract void SerializeBlockBegin(IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeBlockEnd(IConfigurationSerializationContext<T>, Int32)
Serialize a marker or footer where a block or section ends in the serialized stream.
Declaration
public abstract void SerializeBlockEnd(IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeFooter(IConfigurationSerializationContext<T>)
Write the header to the serialized stream.
Declaration
public virtual void SerializeFooter(IConfigurationSerializationContext<T> context)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration |
context | The serialization context. |
SerializeHeader(IConfigurationSerializationContext<T>)
Write the header to the serialized stream.
Declaration
public virtual void SerializeHeader(IConfigurationSerializationContext<T> context)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration |
context | The serialization context. |
SerializeNode(BooleanConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates a System.
Declaration
protected void SerializeNode(BooleanConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean |
node | The node to serialize. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNode(DecimalConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates a decimal value, implemented as a System.
Contrary to the name, this is not implemented as a System.
Declaration
protected void SerializeNode(DecimalConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Decimal |
node | The node to serialize. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNode(DeviceCapabilityElementConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates a Controller
This is only used when serializing syntax trees that came from IInput
Declaration
protected void SerializeNode(DeviceCapabilityElementConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Device |
node | The node to serialize. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNode(EnumConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates an System.
Declaration
protected void SerializeNode(EnumConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Enum |
node | The node to serialize. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNode(IAbstractConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serialize a IAbstract
Declaration
public void SerializeNode(IAbstractConfigurationNode node, IConfigurationSerializationContext<T> context, int index = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| IAbstract |
node | The node to serialize. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNode(IntegralConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates an integral value, implemented as a System.
Declaration
protected void SerializeNode(IntegralConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Integral |
node | The node to serialize. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNode(ListConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a list of configuration nodes.
For each child node to be serialized, the index should be incremented. Serializing a list node will enter a new block, and thus block headers and footers are written at the beginning and end of serialization of this node respectively.
Declaration
protected void SerializeNode(ListConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| List |
node | The list of configuration nodes represented as a List |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNode(StringConfigurationNode, IConfigurationSerializationContext<T>, Int32)
Serializes a configuration node that encapsulates a System.
Declaration
protected void SerializeNode(StringConfigurationNode node, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| String |
node | The node to serialize. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(Boolean, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a Boolean
Declaration
public abstract void SerializeNodeValue(bool value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System. |
value | The raw value of the node. |
| System. |
key | The key of the node. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(Double, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a Decimal
Declaration
public abstract void SerializeNodeValue(double value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System. |
value | The raw value of the node. |
| System. |
key | The key of the node. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(Enum, String, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a Enum
Declaration
public abstract void SerializeNodeValue(Enum enumValue, string value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System. |
enumValue | The value of the node as the System. |
| System. |
value | The raw value of the node. |
| System. |
key | The key of the node. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(Int64, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a Integral
Declaration
public abstract void SerializeNodeValue(long value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System. |
value | The raw value of the node. |
| System. |
key | The key of the node. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializeNodeValue(String, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a String
Declaration
public abstract void SerializeNodeValue(string value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System. |
value | The raw value of the node. |
| System. |
key | The key of the node. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
SerializerNodeValue(ControllerElement, String, String, IConfigurationSerializationContext<T>, Int32)
Serializes the value of a Enum
Declaration
public abstract void SerializerNodeValue(ControllerElement controllerElementValue, string value, string key, IConfigurationSerializationContext<T> context, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Controller |
controllerElementValue | The value of the node |
| System. |
value | The raw value of the node as the string representation of the element consistent with the
IDevice |
| System. |
key | The key of the node. |
| IConfiguration |
context | The serialization context. |
| System. |
index | The position or index of the given node within the current block in the context. |
Transform(IAbstractConfigurationNode)
Declaration
public abstract T Transform(IAbstractConfigurationNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| IAbstract |
node |
Returns
| Type | Description |
|---|---|
| T |