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(); }
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) { header.DeSerialize(br); br.byteOrder = DataReader.ByteOrder.Little; UnityVersion = br.ReadStringNull(); attributes = br.ReadInt32(); embedded = br.ReadBool(); numOfBaseClasses = br.ReadInt32(); classes = new SerializeTypeTreeData[numOfBaseClasses]; for (int i = 0; i < numOfBaseClasses; i++) { classes[i] = new SerializeTypeTreeData(embedded); classes[i].DeSerialize(br); } numOfObjects = br.ReadInt32(); objectInfos = new SerializeAssetObject[numOfObjects]; for (int i = 0; i < numOfObjects; i++) { objectInfos[i] = new SerializeAssetObject((int)header.DataOffset); objectInfos[i].DeSerialize(br); } numOfObjectIdentifiers = br.ReadInt32(); objectIdentifiers = new SerializeObjectIdentifier[numOfObjectIdentifiers]; for (int i = 0; i < numOfObjectIdentifiers; i++) { objectIdentifiers[i] = new SerializeObjectIdentifier(); objectIdentifiers[i].DeSerialize(br); } numOfFileIdentifiers = br.ReadInt32(); fileIdentifiers = new SerializeFileIdentifier[numOfFileIdentifiers]; for (int i = 0; i < numOfFileIdentifiers; i++) { fileIdentifiers[i] = new SerializeFileIdentifier(); fileIdentifiers[i].DeSerialize(br); } }
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 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; }