NewGamePhysics.Networking.InfoLinkSerializer Class Reference

Helper class to serialize/deserialize an InfoLink object. More...

List of all members.

Static Public Member Functions

static string Serialize (InfoLink infoLink)
 Serializes an InfoLink object into XML.
static string SerializeArray (InfoLink[] infoLinks)
 Serializes an array of InfoLink objects into XML.
static InfoLink Deserialize (string xmlText)
 Deserialize XML into an InfoLink object.
static InfoLink[] DeserializeArray (string xmlText)
 Deserialize XML into an array of InfoLink objects.

Detailed Description

Helper class to serialize/deserialize an InfoLink object.

Definition at line 18 of file InfoLinkSerializer.cs.


Member Function Documentation

static InfoLink NewGamePhysics.Networking.InfoLinkSerializer.Deserialize ( string  xmlText  )  [static]

Deserialize XML into an InfoLink object.

Parameters:
xmlText The XML to deserialize.
Returns:
The InfoLink object.

Definition at line 57 of file InfoLinkSerializer.cs.

00058         {
00059             XmlSerializer xmlSerializer = new XmlSerializer(typeof(InfoLink));
00060             TextReader textReader = new StringReader(xmlText);
00061             InfoLink infoLink = (InfoLink)xmlSerializer.Deserialize(textReader);
00062             return infoLink;
00063         }

static InfoLink [] NewGamePhysics.Networking.InfoLinkSerializer.DeserializeArray ( string  xmlText  )  [static]

Deserialize XML into an array of InfoLink objects.

Parameters:
xmlText The XML to deserialize.
Returns:
The InfoLink array.

Definition at line 70 of file InfoLinkSerializer.cs.

00071         {
00072             XmlSerializer xmlSerializer = new XmlSerializer(typeof(InfoLink));
00073             TextReader textReader = new StringReader(xmlText);
00074             XmlTextReader xmlReader = new XmlTextReader(textReader);
00075             xmlReader.Normalization = true;
00076             List<InfoLink> infoLinks = new List<InfoLink>();
00077             while (!xmlReader.EOF && xmlReader.ReadToFollowing("InfoLink"))
00078             {
00079                 InfoLink newInfoLink = (InfoLink)xmlSerializer.Deserialize(xmlReader);
00080                 infoLinks.Add(newInfoLink);
00081             }
00082 
00083             return infoLinks.ToArray();
00084         }

static string NewGamePhysics.Networking.InfoLinkSerializer.Serialize ( InfoLink  infoLink  )  [static]

Serializes an InfoLink object into XML.

Parameters:
infoLink The InfoLink object to serialize.
Returns:
The XML representation of the InfoLink object.

Definition at line 25 of file InfoLinkSerializer.cs.

00026         {
00027             string xmlText = string.Empty;
00028             XmlSerializer xmlSerializer = new XmlSerializer(typeof(InfoLink));
00029             StringBuilder xmlSb = new StringBuilder();
00030             TextWriter textWriter = new StringWriter(xmlSb);
00031             xmlSerializer.Serialize(textWriter, infoLink);
00032             xmlText = xmlSb.ToString();
00033             return xmlText;
00034         }

static string NewGamePhysics.Networking.InfoLinkSerializer.SerializeArray ( InfoLink[]  infoLinks  )  [static]

Serializes an array of InfoLink objects into XML.

Parameters:
infoLinks The InfoLink array to serialize.
Returns:
The XML representation of the InfoLink object.

Definition at line 41 of file InfoLinkSerializer.cs.

00042         {
00043             string xmlText = string.Empty;
00044             XmlSerializer xmlSerializer = new XmlSerializer(typeof(InfoLink[]));
00045             StringBuilder xmlSb = new StringBuilder();
00046             TextWriter textWriter = new StringWriter(xmlSb);
00047             xmlSerializer.Serialize(textWriter, infoLinks);
00048             xmlText = xmlSb.ToString();
00049             return xmlText;
00050         }


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

Generated by  doxygen 1.6.2