Class Utils.Xml
- Namespace
- RichHudFramework
- Assembly
- RichHudClient.dll
Safe wrappers around Space Engineers' built-in XML serialization utilities. Exceptions are caught and returned as KnownException rather than thrown.
public static class Utils.Xml
- Inheritance
-
Utils.Xml
Methods
TryDeserialize<T>(string, out T)
Attempts to deserialize an XML string into an object of the specified type.
Wraps MyAPIGateway.Utilities.SerializeFromXML()
public static KnownException TryDeserialize<T>(string xmlIn, out T obj)
Parameters
xmlInstringThe XML string to deserialize.
objTReceives the deserialized instance on success; default(T) on failure.
Returns
- KnownException
Null on success; otherwise a KnownException describing the error.
Type Parameters
TTarget type matching the original serialized object.
TrySerialize<T>(T, out string)
Attempts to serialize an object to an XML string.
Wraps MyAPIGateway.Utilities.SerializeToXML()
public static KnownException TrySerialize<T>(T obj, out string xmlOut)
Parameters
objTThe instance to serialize.
xmlOutstringReceives the XML string on success; null on failure.
Returns
- KnownException
Null on success; otherwise a KnownException describing the error.
Type Parameters
TType of object to serialize (usually a plain data class).