public void Read(SerializedFileReader reader) { if (IsReadLongID(reader.Generation)) { reader.AlignStream(AlignType.Align4); PathID = reader.ReadInt64(); } else { PathID = reader.ReadInt32(); } DataOffset = reader.ReadInt32(); DataSize = reader.ReadInt32(); if (IsReadTypeIndex(reader.Generation)) { TypeIndex = reader.ReadInt32(); } else { TypeID = reader.ReadInt32(); ClassID = (ClassIDType)reader.ReadInt16(); ScriptID = reader.ReadInt16(); } if (IsReadUnknown(reader.Generation)) { Unknown = reader.ReadBoolean(); } }
private void ReadScheme() { using (PartialStream stream = new PartialStream(m_stream, m_offset, m_size)) { using (EndianReader reader = new EndianReader(stream, EndianType.BigEndian)) { Header.Read(reader); } EndianType endianess = Header.SwapEndianess ? EndianType.BigEndian : EndianType.LittleEndian; using (SerializedFileReader reader = new SerializedFileReader(stream, endianess, Header.Generation)) { if (IsMetadataAtTheEnd(reader.Generation)) { reader.BaseStream.Position = Header.FileSize - Header.MetadataSize; reader.BaseStream.Position++; } Metadata.Read(reader); } } #warning TEMP HACK Flags = Metadata.Hierarchy.Platform == Platform.NoTarget ? TransferInstructionFlags.NoTransferInstructionFlags : Flags; if (FilenameUtils.IsEngineResource(Name) || Header.Generation < FileGeneration.FG_500a1 && FilenameUtils.IsBuiltinExtra(Name)) { Flags |= TransferInstructionFlags.IsBuiltinResourcesFile; } Flags |= Header.SwapEndianess ? TransferInstructionFlags.SwapEndianess : TransferInstructionFlags.NoTransferInstructionFlags; }
public void Read(SerializedFileReader reader) { if (IsRead5Format(reader.Generation)) { int nodesCount = reader.ReadInt32(); if (nodesCount < 0) { throw new Exception($"Invalid type tree's node count {nodesCount}"); } int stringSize = reader.ReadInt32(); if (stringSize < 0) { throw new Exception($"Invalid type tree's string size {stringSize}"); } m_nodes = new TypeTreeNode[nodesCount]; long stringPosition = reader.BaseStream.Position + nodesCount * TypeTreeNode.NodeSize; for (int i = 0; i < nodesCount; i++) { TypeTreeNode node = new TypeTreeNode(); node.Read(reader, stringPosition); m_nodes[i] = node; } reader.BaseStream.Position += stringSize; } else { List <TypeTreeNode> nodes = new List <TypeTreeNode>(); ReadTreeNode(reader, nodes, 0); m_nodes = nodes.ToArray(); } }
public void Read(SerializedFileReader reader, RTTIClassHierarchyDescriptor heirarchy) { if (IsReadLongID(reader.Generation)) { reader.AlignStream(AlignType.Align4); PathID = reader.ReadInt64(); } else { PathID = reader.ReadInt32(); } Offset = reader.ReadUInt32(); Size = reader.ReadInt32(); if (IsReadTypeIndex(reader.Generation)) { int TypeIndex = reader.ReadInt32(); RTTIBaseClassDescriptor type = heirarchy.Types[TypeIndex]; TypeID = type.ClassID == ClassIDType.MonoBehaviour ? (-type.ScriptID - 1) : (int)type.ClassID; ClassID = type.ClassID; ScriptID = type.ScriptID; } else { TypeID = reader.ReadInt32(); ClassID = (ClassIDType)reader.ReadInt16(); ScriptID = reader.ReadInt16(); } if (IsReadUnknown(reader.Generation)) { IsStripped = reader.ReadBoolean(); } }
public void Read(SerializedFileReader reader) { Type = reader.ReadStringZeroTerm(); Name = reader.ReadStringZeroTerm(); ByteSize = reader.ReadInt32(); Index = reader.ReadInt32(); IsArray = reader.ReadInt32() != 0; Version = reader.ReadInt32(); MetaFlag = reader.ReadUInt32(); }
public void Read(SerializedFileReader reader) { FileID = reader.ReadInt32(); if (IsReadLongPathID(reader.Generation)) { reader.AlignStream(AlignType.Align4); PathID = reader.ReadInt64(); } else { PathID = reader.ReadInt32(); } }
private static void ReadTreeNode(SerializedFileReader reader, ICollection <TypeTreeNode> nodes, byte depth) { TypeTreeNode node = new TypeTreeNode(depth); node.Read(reader); nodes.Add(node); int childCount = reader.ReadInt32(); for (int i = 0; i < childCount; i++) { ReadTreeNode(reader, nodes, (byte)(depth + 1)); } }
public void Read(SerializedFileReader reader, long stringPosition) { Version = reader.ReadUInt16(); Depth = reader.ReadByte(); IsArray = reader.ReadBoolean(); uint type = reader.ReadUInt32(); uint name = reader.ReadUInt32(); ByteSize = reader.ReadInt32(); Index = reader.ReadInt32(); MetaFlag = reader.ReadUInt32(); Type = ReadString(reader, stringPosition, type); Name = ReadString(reader, stringPosition, name); }
private static string ReadString(SerializedFileReader reader, long stringPosition, uint value) { bool isCustomType = (value & 0x80000000) == 0; if (isCustomType) { long position = reader.BaseStream.Position; reader.BaseStream.Position = stringPosition + value; string stringValue = reader.ReadStringZeroTerm(); reader.BaseStream.Position = position; return(stringValue); } else { uint type = value & 0x7FFFFFFF; TreeNodeType nodeType = (TreeNodeType)type; if (!Enum.IsDefined(typeof(TreeNodeType), nodeType)) { throw new Exception($"Unsupported asset class type name '{nodeType}''"); } return(nodeType.ToTypeString()); } }
public void Read(SerializedFileReader reader) { Read((EndianReader)reader); }