Common
A library of common classes.
XmlSerialization Class Reference

Contains methods for serializing objects to and from XML. More...

Static Public Member Functions

static string GetXmlString< T > (T graph, XmlWriterSettings settings=null)
 Returns the pretty XML string for the object. More...
 
static T LoadEncryptedXml< T > (string path, byte[] key)
 Decrypts and deserializes an object from the specified file. More...
 
static T LoadXml< T > (byte[] bytes)
 Loads an object from a byte array using the DataContractSerializer. More...
 
static T LoadXml< T > (string path)
 Loads an object from a file path using the DataContractSerializer. More...
 
static T LoadXmlString< T > (string xml)
 Loads an object from an XML string using the DataContractSerializer. More...
 
static XmlWriterSettings PrettyXmlWriterSettings ()
 Returns a new instance of XML writer settings for pretty printing. More...
 
static void SaveEncryptedXml< T > (string path, T graph, byte[] key)
 Serializes and encrypts and object to the specified file. More...
 
static void SaveXml< T > (string path, T graph)
 Saves the object to the file path using the DataContractSerializer. More...
 

Detailed Description

Contains methods for serializing objects to and from XML.

Definition at line 11 of file XmlSerialization.cs.

Member Function Documentation

◆ GetXmlString< T >()

static string GetXmlString< T > ( graph,
XmlWriterSettings  settings = null 
)
static

Returns the pretty XML string for the object.

Parameters
graphThe object for serialization.
settingsThe XML writer settings. Pretty print used if none specified.

Definition at line 31 of file XmlSerialization.cs.

◆ LoadEncryptedXml< T >()

static T LoadEncryptedXml< T > ( string  path,
byte[]  key 
)
static

Decrypts and deserializes an object from the specified file.

Parameters
pathThe file path.
keyThe private key.

Definition at line 125 of file XmlSerialization.cs.

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

static T LoadXml< T > ( byte[]  bytes)
static

Loads an object from a byte array using the DataContractSerializer.

Parameters
bytesThe byte array.

Definition at line 85 of file XmlSerialization.cs.

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

static T LoadXml< T > ( string  path)
static

Loads an object from a file path using the DataContractSerializer.

Parameters
pathThe file path.

Definition at line 71 of file XmlSerialization.cs.

◆ LoadXmlString< T >()

static T LoadXmlString< T > ( string  xml)
static

Loads an object from an XML string using the DataContractSerializer.

Parameters
xmlThe XML string.

Definition at line 99 of file XmlSerialization.cs.

◆ PrettyXmlWriterSettings()

static XmlWriterSettings PrettyXmlWriterSettings ( )
static

Returns a new instance of XML writer settings for pretty printing.

Definition at line 16 of file XmlSerialization.cs.

◆ SaveEncryptedXml< T >()

static void SaveEncryptedXml< T > ( string  path,
graph,
byte[]  key 
)
static

Serializes and encrypts and object to the specified file.

Parameters
pathThe file path.
graphThe object.
keyThe private key.

Definition at line 110 of file XmlSerialization.cs.

◆ SaveXml< T >()

static void SaveXml< T > ( string  path,
graph 
)
static

Saves the object to the file path using the DataContractSerializer.

Parameters
pathThe save file path.
graphThe object for serialization.

Definition at line 57 of file XmlSerialization.cs.


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