public static void SerializeTaggedProperties( IUnrealSerializer serializer, SerializeProperty serializeProperty, Dictionary <PropertyTag, object> unknownProperties) { SerializeTaggedProperties(serializer, serializeProperty, unknownProperties, true); }
public override void Deserialize(SerializeProperty rootProperty) { base.Deserialize(rootProperty); bindField("m_FilterMode", rootProperty); bindField("m_Aniso", rootProperty); bindField("m_MipBias", rootProperty); bindField("m_WrapMode", rootProperty); }
/****************************************************************************/ private static void SerializeChildren(cXMLWriter objWriter, object objInstance) { Type objType = objInstance.GetType(); PropertyInfo[] aProperties = objType.GetProperties(); // ??? TODO: Let's revisit the filter some other time List <SerializeProperty> aAttributes = new List <SerializeProperty>(); List <SerializeProperty> aLists = new List <SerializeProperty>(); List <SerializeProperty> aElements = new List <SerializeProperty>(); // Gather all the properties that have an XmlSerialize attribute foreach (PropertyInfo objProperty in aProperties) { XmlSerialize objAttribute = XmlSerialize.GetSerializeAttribute(objProperty); if (objAttribute != null) { SerializeProperty objProp = new SerializeProperty(objProperty, objAttribute); // Put into the right bucket if (objAttribute is XmlAttributeSerialize) { aAttributes.Add(objProp); } else if (objAttribute is XmlSerializeList) { aLists.Add(objProp); } else { aElements.Add(objProp); } } } // Write out the xml attributes first foreach (SerializeProperty objProperty in aAttributes) { objProperty.Attribute.SerializeProperty(objWriter, objInstance, objProperty.Property); } // Now write out all of the elements foreach (SerializeProperty objProperty in aElements) { objProperty.Attribute.SerializeProperty(objWriter, objInstance, objProperty.Property); } // Now write out all of the lists foreach (SerializeProperty objProperty in aLists) { objProperty.Attribute.SerializeProperty(objWriter, objInstance, objProperty.Property); } return; }
public override void Deserialize(SerializeProperty rootProperty) { m_FileID = (int)rootProperty.FindChild("m_FileID").Value; var pathID = rootProperty.FindChild("m_PathID"); if (pathID.propertyType == SerializePropertyType.Int) { m_PathID = (ulong)((int)pathID.Value); } else if(pathID.propertyType == SerializePropertyType.ULong) { m_PathID =(ulong)pathID.Value; } }
public static void SerializeTaggedProperties( IUnrealSerializer serializer, SerializeProperty serializeProperty, Dictionary <PropertyTag, object> unknownProperties, bool safe) { if (serializer.Mode != UnrealSerializationMode.Loading) { throw new InvalidOperationException(); } while (true) { var tag = new PropertyTag(); serializer.Serialize(ref tag); if (tag.Name == "None") { break; } if (safe == false) { if (serializeProperty == null || serializeProperty(serializer, ref tag) == false) { var bytes = new byte[tag.Size]; serializer.Serialize(bytes, 0, bytes.Length); unknownProperties.Add(tag, bytes); } } else { var bytes = new byte[tag.Size]; serializer.Serialize(bytes, 0, bytes.Length); if (serializeProperty == null) { unknownProperties.Add(tag, bytes); } else { using (var temp = new MemoryStream(bytes, false)) { var safeSerializer = serializer.New(temp); if (serializeProperty(safeSerializer, ref tag) == false) { unknownProperties.Add(tag, bytes); } } } } } }
public override void Deserialize(SerializeProperty rootProperty) { m_FileID = (int)rootProperty.FindChild("m_FileID").Value; var pathID = rootProperty.FindChild("m_PathID"); if (pathID.propertyType == SerializePropertyType.Int) { m_PathID = (ulong)((int)pathID.Value); } else if (pathID.propertyType == SerializePropertyType.ULong) { m_PathID = (ulong)pathID.Value; } }
protected void bindField(string fieldName, SerializeProperty rootProperty) { var field = GetType().GetField(fieldName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); if (field == null) { Debug.LogError("Can't find field {0} in {1}.", fieldName, GetType().Name); return; } var property = rootProperty.FindChild(fieldName); if (property == null) { Debug.LogError("Can't find property {0} in {1}.", fieldName, GetType().Name); return; } field.SetValue(this, property.Value); }
public override void Deserialize(SerializeProperty rootProperty) { var array = (SerializeProperty[])rootProperty.FindChild("m_Container.Array").Value; foreach (var data in array) { string path = (string)data.FindChild("path").Value; var assetProperty = data.FindChild("asset"); var asset = new PptrObject(); asset.Deserialize(assetProperty); List<PptrObject> list = null; if (!m_Container.TryGetValue(path, out list)) { list = new List<PptrObject>(); m_Container[path] = list; } list.Add(asset); } }
public override void Deserialize(SerializeProperty rootProperty) { base.Deserialize(rootProperty); bindField("m_Width", rootProperty); bindField("m_Height", rootProperty); bindField("m_CompleteImageSize", rootProperty); bindField("m_TextureFormat", rootProperty); bindField("m_MipCount", rootProperty); bindField("m_IsReadable", rootProperty); bindField("m_ReadAllowed", rootProperty); bindField("m_ImageCount", rootProperty); bindField("m_TextureDimension", rootProperty); m_TextureSettings.Deserialize(rootProperty.FindChild("m_TextureSettings")); bindField("m_LightmapFormat", rootProperty); bindField("m_ColorSpace", rootProperty); image_data = (byte[])rootProperty.FindChild("image data").Value; }
public override void Deserialize(SerializeProperty rootProperty) { var array = (SerializeProperty[])rootProperty.FindChild("m_Container.Array").Value; foreach (var data in array) { string path = (string)data.FindChild("path").Value; var assetProperty = data.FindChild("asset"); var asset = new PptrObject(); asset.Deserialize(assetProperty); List <PptrObject> list = null; if (!m_Container.TryGetValue(path, out list)) { list = new List <PptrObject>(); m_Container[path] = list; } list.Add(asset); } }
public override void Deserialize(SerializeProperty rootProperty) { m_Name = (string)rootProperty.FindChild("m_Name").Value; }
public override void Deserialize(SerializeProperty rootProperty) { base.Deserialize(rootProperty); m_FontData = (byte[])rootProperty.FindChild("m_FontData.Array").Value; }
public virtual void Deserialize(SerializeProperty rootProperty) { }
public override void Deserialize(SerializeProperty rootProperty) { base.Deserialize(rootProperty); m_Script = (string)rootProperty.FindChild("m_Script").Value; m_PathName = (string)rootProperty.FindChild("m_PathName").Value; }