示例#1
0
 public override void DeSerialize(DataReader br)
 {
     PathID      = br.ReadUint32();
     offset      = br.ReadUint32();
     length      = br.ReadUint32();
     typeID      = br.ReadInt32();
     classID     = br.ReadInt16();
     isDestroyed = br.ReadInt16();
     data        = br.GetRangeBytes((uint)(mDataOffset + offset), length);
 }
示例#2
0
 public override void DeSerialize(DataReader br)
 {
     br.Align(4);
     PathID          = br.ReadInt64();
     offset          = br.ReadUint32();
     length          = br.ReadUint32();
     typeID          = br.ReadInt32();
     classID         = br.ReadInt16();
     scriptTypeIndex = br.ReadInt16();
     stripped        = br.ReadBool();
     data            = br.GetRangeBytes((uint)(mDataOffset + offset), length);
 }
示例#3
0
 public override void DeSerialize(DataReader br)
 {
     version    = br.ReadInt16();
     treeLevel  = br.ReadByte();
     isArray    = br.ReadBool();
     typeOffset = br.ReadInt32();
     nameOffset = br.ReadInt32();
     size       = br.ReadInt32();
     index      = br.ReadInt32();
     metaFlag   = br.ReadInt32();
 }
示例#4
0
        public object readArrayValue(TypeTree typeTree, DataReader data)
        {
            var elementType = typeTree.GetChildren()[1];

            arrayLength      = data.ReadInt32();
            arrayElementType = typeStr2PropertyType(elementType.type);
            object ret = null;

            switch (arrayElementType)
            {
            case SerializePropertyType.Bool:
                ret = data.ReadBool(arrayLength);
                break;

            case SerializePropertyType.Byte:
                ret = data.ReadBytes(arrayLength);
                break;

            case SerializePropertyType.Double:
                ret = data.ReadDouble(arrayLength);
                break;

            case SerializePropertyType.Float:
                ret = data.ReadFloat(arrayLength);
                break;

            case SerializePropertyType.Int:
                ret = data.ReadInt32(arrayLength);
                break;

            case SerializePropertyType.Long:
                ret = data.ReadInt64(arrayLength);
                break;

            case SerializePropertyType.SByte:
                ret = data.ReadSbytes(arrayLength);
                break;

            case SerializePropertyType.Short:
                ret = data.ReadInt16(arrayLength);
                break;

            case SerializePropertyType.String:
                string[] stringArray = new string[arrayLength];
                for (int i = 0; i < arrayLength; i++)
                {
                    int strSize = data.ReadInt32();
                    stringArray[i] = UnicodeEncoding.UTF8.GetString(data.ReadBytes(strSize));
                    data.Align(4);
                }
                ret = stringArray;
                break;

            case SerializePropertyType.UInt:
                ret = data.ReadUint32(arrayLength);
                break;

            case SerializePropertyType.ULong:
                ret = data.ReadUInt64(arrayLength);
                break;

            case SerializePropertyType.UShort:
                ret = data.ReadUInt16(arrayLength);
                break;

            default:
                SerializeProperty[] properArray = new SerializeProperty[arrayLength];
                for (int i = 0; i < arrayLength; i++)
                {
                    SerializeProperty value = null;
                    if (arrayElementType == SerializePropertyType.Property || arrayElementType == SerializePropertyType.Array)
                    {
                        var sp = new SerializeProperty(elementType);
                        sp.DeSerialize(data);
                        value = sp;
                    }
                    properArray[i] = value;
                }
                ret = properArray;
                break;
            }

            data.Align(4);
            return(ret);
        }
示例#5
0
        private object readValue(SerializePropertyType ptype, TypeTree typeTree, DataReader data)
        {
            object ret = null;

            switch (ptype)
            {
            case SerializePropertyType.Bool:
                ret = data.ReadBool();
                break;

            case SerializePropertyType.SByte:
                ret = data.ReadSbyte();
                break;

            case SerializePropertyType.Byte:
                ret = data.ReadByte();
                break;

            case SerializePropertyType.Short:
                ret = data.ReadInt16();
                break;

            case SerializePropertyType.UShort:
                ret = data.ReadUInt16();
                break;

            case SerializePropertyType.Int:
                ret = data.ReadInt32();
                break;

            case SerializePropertyType.UInt:
                ret = data.ReadUint32();
                break;

            case SerializePropertyType.Long:
                ret = data.ReadInt64();
                break;

            case SerializePropertyType.ULong:
                ret = data.ReadUInt64();
                break;

            case SerializePropertyType.Float:
                ret = data.ReadFloat();
                break;

            case SerializePropertyType.Double:
                ret = data.ReadDouble();
                break;

            case SerializePropertyType.String:
                int strSize = data.ReadInt32();
                ret = UnicodeEncoding.UTF8.GetString(data.ReadBytes(strSize));
                //ret = UTF8Encoding.Default.GetString();
                break;

            default:
                break;
            }

            if (((typeTree.metaFlag & TypeTree.FLAG_FORCE_ALIGN) != 0) || propertyType == SerializePropertyType.String)
            {
                data.Align(4);
            }

            return(ret);
        }
 public override void DeSerialize(DataReader br)
 {
     PathID = br.ReadUint32();
     offset = br.ReadUint32();
     length = br.ReadUint32();
     typeID = br.ReadInt32();
     classID = br.ReadInt16();
     isDestroyed = br.ReadInt16();
     data = br.GetRangeBytes((uint)(mDataOffset + offset), length);
 }
        public object readArrayValue(TypeTree typeTree, DataReader data)
        {            
            var elementType = typeTree.GetChildren()[1];
            arrayLength = data.ReadInt32();
            arrayElementType = typeStr2PropertyType(elementType.type);
            object ret = null;
            switch (arrayElementType) {
                case SerializePropertyType.Bool:
                ret = data.ReadBool(arrayLength);
                break;
                case SerializePropertyType.Byte:
                ret = data.ReadBytes(arrayLength);
                break;
                case SerializePropertyType.Double:
                ret = data.ReadDouble(arrayLength);
                break;
                case SerializePropertyType.Float:
                ret = data.ReadFloat(arrayLength);
                break;
                case SerializePropertyType.Int:
                ret = data.ReadInt32(arrayLength);
                break;
                case SerializePropertyType.Long:
                ret = data.ReadInt64(arrayLength);
                break;
                case SerializePropertyType.SByte:
                ret = data.ReadSbytes(arrayLength);
                break;
                case SerializePropertyType.Short:
                ret = data.ReadInt16(arrayLength);
                break;
                case SerializePropertyType.String:
                string[] stringArray = new string[arrayLength];
                for (int i = 0; i < arrayLength; i++) {
                    int strSize = data.ReadInt32();
                    stringArray[i] = UnicodeEncoding.UTF8.GetString(data.ReadBytes(strSize));
                    data.Align(4);
                }
                ret = stringArray;
                break;
                case SerializePropertyType.UInt:
                ret = data.ReadUint32(arrayLength);
                break;
                case SerializePropertyType.ULong:
                ret = data.ReadUInt64(arrayLength);
                break;
                case SerializePropertyType.UShort:
                ret = data.ReadUInt16(arrayLength);
                break;
                default:
                SerializeProperty[] properArray = new SerializeProperty[arrayLength];
                for (int i = 0; i < arrayLength; i++) {
                    SerializeProperty value = null;
                    if (arrayElementType == SerializePropertyType.Property || arrayElementType == SerializePropertyType.Array) {
                        var sp = new SerializeProperty(elementType);
                        sp.DeSerialize(data);
                        value = sp;
                    }
                    properArray[i] = value;
                }
                ret = properArray;
                break;
            }

            data.Align(4);
            return ret;
        }
        private object readValue(SerializePropertyType ptype,TypeTree typeTree, DataReader data)
        {
            
            object ret = null;
            switch (ptype) {
                case SerializePropertyType.Bool:
                ret = data.ReadBool();
                break;
                case SerializePropertyType.SByte:
                ret = data.ReadSbyte();
                break;
                case SerializePropertyType.Byte:
                ret = data.ReadByte();
                break;
                case SerializePropertyType.Short:
                ret = data.ReadInt16();
                break;
                case SerializePropertyType.UShort:
                ret = data.ReadUInt16();
                break;
                case SerializePropertyType.Int:
                ret = data.ReadInt32();
                break;
                case SerializePropertyType.UInt:
                ret = data.ReadUint32();
                break;
                case SerializePropertyType.Long:
                ret = data.ReadInt64();
                break;
                case SerializePropertyType.ULong:
                ret = data.ReadUInt64();
                break;
                case SerializePropertyType.Float:
                ret = data.ReadFloat();
                break;
                case SerializePropertyType.Double:
                ret = data.ReadDouble();
                break;
                case SerializePropertyType.String:
                int strSize = data.ReadInt32();
                ret = UnicodeEncoding.UTF8.GetString(data.ReadBytes(strSize));
                //ret = UTF8Encoding.Default.GetString();
                break;
                default:
                break;
            }

            if (((typeTree.metaFlag & TypeTree.FLAG_FORCE_ALIGN) != 0)  || propertyType == SerializePropertyType.String) {
                data.Align(4);
            }

            return ret;
        }
 public override void DeSerialize(DataReader br)
 {
     br.Align(4);
     PathID = br.ReadInt64();
     offset = br.ReadUint32();
     length = br.ReadUint32();
     typeID = br.ReadInt32();
     classID = br.ReadInt16();
     scriptTypeIndex = br.ReadInt16();
     stripped = br.ReadBool();
     data = br.GetRangeBytes((uint)(mDataOffset + offset), length);
 }
 public override void DeSerialize(DataReader br)
 {
     version = br.ReadInt16();
     treeLevel = br.ReadByte();
     isArray = br.ReadBool();
     typeOffset = br.ReadInt32();
     nameOffset = br.ReadInt32();
     size = br.ReadInt32();
     index = br.ReadInt32();
     metaFlag = br.ReadInt32();
 }