Ejemplo n.º 1
0
 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();
     }
 }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
 public void Read(SerializedFileReader reader)
 {
     FileID = reader.ReadInt32();
     if (IsReadLongPathID(reader.Generation))
     {
         reader.AlignStream(AlignType.Align4);
         PathID = reader.ReadInt64();
     }
     else
     {
         PathID = reader.ReadInt32();
     }
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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));
            }
        }