public object DeserializeObject(GenericReader reader) { object output = null; XmlObjectType xmlObjectType = (XmlObjectType)reader.ReadInt(); if (xmlObjectType == XmlObjectType.Mobile) { output = reader.ReadMobile(); } else if (xmlObjectType == XmlObjectType.Item) { output = reader.ReadItem(); } else if (xmlObjectType == XmlObjectType.MobileList) { output = reader.ReadStrongMobileList(); } else if (xmlObjectType == XmlObjectType.ItemList) { output = reader.ReadStrongItemList(); } else if (xmlObjectType == XmlObjectType.ArrayList) { int elements = reader.ReadInt(); ArrayList list = new ArrayList(elements); for (int i = 0; i < elements; i++) { list.Add(DeserializeObject(reader)); } output = list; } else if (xmlObjectType == XmlObjectType.DateTime) { output = reader.ReadDateTime(); } else if (xmlObjectType == XmlObjectType.DateTimeOffset) { output = reader.ReadDateTimeOffset(); } else if (xmlObjectType == XmlObjectType.BaseGuild) { output = reader.ReadGuild(); } else if (xmlObjectType == XmlObjectType.IPAddress) { output = reader.ReadIPAddress(); } else if (xmlObjectType == XmlObjectType.Map) { output = reader.ReadMap(); } else if (xmlObjectType == XmlObjectType.Point3D) { output = reader.ReadPoint3D(); } else if (xmlObjectType == XmlObjectType.Point2D) { output = reader.ReadPoint2D(); } else if (xmlObjectType == XmlObjectType.TimeSpan) { output = reader.ReadTimeSpan(); } else if (xmlObjectType == XmlObjectType.Rectangle2D) { output = reader.ReadRect2D(); } else if (xmlObjectType == XmlObjectType.Rectangle3D) { output = reader.ReadRect3D(); } else if (xmlObjectType == XmlObjectType.Double) { output = reader.ReadDouble(); } else if (xmlObjectType == XmlObjectType.Integer) { output = reader.ReadInt(); } else if (xmlObjectType == XmlObjectType.Boolean) { output = reader.ReadBool(); } else if (xmlObjectType == XmlObjectType.UInt64) { output = reader.ReadULong(); } else if (xmlObjectType == XmlObjectType.String) { output = reader.ReadString(); } else if (xmlObjectType == XmlObjectType.Type) { output = UberScriptFunctions.Methods.TYPE(null, reader.ReadString()); } else if (xmlObjectType == XmlObjectType.Other) { LoggingCustom.Log( "ERROR_Uberscript.txt", DateTime.Now + ": xmlobject: " + Name + " attached to " + AttachedTo + " with data of type other was deserialized"); } return output; }
public object DeserializeObject(GenericReader reader) { object output = null; XmlObjectType xmlObjectType = (XmlObjectType)reader.ReadInt(); if (xmlObjectType == XmlObjectType.Mobile) { output = reader.ReadMobile(); } else if (xmlObjectType == XmlObjectType.Item) { output = reader.ReadItem(); } else if (xmlObjectType == XmlObjectType.MobileList) { output = reader.ReadStrongMobileList(); } else if (xmlObjectType == XmlObjectType.ItemList) { output = reader.ReadStrongItemList(); } else if (xmlObjectType == XmlObjectType.ArrayList) { int elements = reader.ReadInt(); ArrayList list = new ArrayList(elements); for (int i = 0; i < elements; i++) { list.Add(DeserializeObject(reader)); } output = list; } else if (xmlObjectType == XmlObjectType.DateTime) { output = reader.ReadDateTime(); } else if (xmlObjectType == XmlObjectType.DateTimeOffset) { output = reader.ReadDateTimeOffset(); } else if (xmlObjectType == XmlObjectType.BaseGuild) { output = reader.ReadGuild(); } else if (xmlObjectType == XmlObjectType.IPAddress) { output = reader.ReadIPAddress(); } else if (xmlObjectType == XmlObjectType.Map) { output = reader.ReadMap(); } else if (xmlObjectType == XmlObjectType.Point3D) { output = reader.ReadPoint3D(); } else if (xmlObjectType == XmlObjectType.Point2D) { output = reader.ReadPoint2D(); } else if (xmlObjectType == XmlObjectType.TimeSpan) { output = reader.ReadTimeSpan(); } else if (xmlObjectType == XmlObjectType.Rectangle2D) { output = reader.ReadRect2D(); } else if (xmlObjectType == XmlObjectType.Rectangle3D) { output = reader.ReadRect3D(); } else if (xmlObjectType == XmlObjectType.Double) { output = reader.ReadDouble(); } else if (xmlObjectType == XmlObjectType.Integer) { output = reader.ReadInt(); } else if (xmlObjectType == XmlObjectType.Boolean) { output = reader.ReadBool(); } else if (xmlObjectType == XmlObjectType.UInt64) { output = reader.ReadULong(); } else if (xmlObjectType == XmlObjectType.String) { output = reader.ReadString(); } else if (xmlObjectType == XmlObjectType.Type) { output = UberScriptFunctions.Methods.TYPE(null, reader.ReadString()); } else if (xmlObjectType == XmlObjectType.Other) { LoggingCustom.Log( "ERROR_Uberscript.txt", DateTime.Now + ": xmlobject: " + Name + " attached to " + AttachedTo + " with data of type other was deserialized"); } return(output); }