Exemplo n.º 1
0
 public static void SerializeTaggedProperties(
     IUnrealSerializer serializer,
     SerializeProperty serializeProperty,
     Dictionary <PropertyTag, object> unknownProperties)
 {
     SerializeTaggedProperties(serializer, serializeProperty, unknownProperties, true);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        /****************************************************************************/
        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;
        }
Exemplo n.º 4
0
        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;
            }

        }
Exemplo n.º 5
0
        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);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        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;
            }
        }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
 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);
     }
 }
Exemplo n.º 9
0
 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;
 }
Exemplo n.º 10
0
        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);
            }
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
 public override void Deserialize(SerializeProperty rootProperty)
 {
     m_Name = (string)rootProperty.FindChild("m_Name").Value;
 }
Exemplo n.º 13
0
 public override void Deserialize(SerializeProperty rootProperty)
 {
     base.Deserialize(rootProperty);
     m_FontData = (byte[])rootProperty.FindChild("m_FontData.Array").Value;
 }
Exemplo n.º 14
0
 public override void Deserialize(SerializeProperty rootProperty)
 {
     base.Deserialize(rootProperty);
     m_FontData = (byte[])rootProperty.FindChild("m_FontData.Array").Value;
 }
Exemplo n.º 15
0
 public virtual void Deserialize(SerializeProperty rootProperty)
 {
 }
Exemplo n.º 16
0
 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;
 }
Exemplo n.º 17
0
 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;
 }
Exemplo n.º 18
0
        public virtual void Deserialize(SerializeProperty rootProperty)
        {

        }
Exemplo n.º 19
0
 public override void Deserialize(SerializeProperty rootProperty)
 {
     m_Name = (string)rootProperty.FindChild("m_Name").Value;
    
 }