Ejemplo n.º 1
0
        public void Read(SerializedFileStream stream)
        {
            if (IsRead5Format(stream.Generation))
            {
                int nodesCount = stream.ReadInt32();
                if (nodesCount < 0)
                {
                    throw new Exception($"Invalid type tree's node count {nodesCount}");
                }

                int stringSize = stream.ReadInt32();
                if (stringSize < 0)
                {
                    throw new Exception($"Invalid type tree's string size {stringSize}");
                }

                m_nodes = new TypeTreeNode[nodesCount];
                long stringPosition = stream.BaseStream.Position + nodesCount * TypeTreeNode.NodeSize;
                for (int i = 0; i < nodesCount; i++)
                {
                    TypeTreeNode node = new TypeTreeNode();
                    node.Read(stream, stringPosition);
                    m_nodes[i] = node;
                }
                stream.BaseStream.Position += stringSize;
            }
            else
            {
                List <TypeTreeNode> nodes = new List <TypeTreeNode>();
                ReadTreeNode(stream, nodes, 0);
                m_nodes = nodes.ToArray();
            }
        }
Ejemplo n.º 2
0
 public void Read(SerializedFileStream stream)
 {
     Type     = stream.ReadStringZeroTerm();
     Name     = stream.ReadStringZeroTerm();
     ByteSize = stream.ReadInt32();
     Index    = stream.ReadInt32();
     IsArray  = stream.ReadInt32() != 0;
     Version  = stream.ReadInt32();
     MetaFlag = stream.ReadUInt32();
 }
Ejemplo n.º 3
0
        public void Read(SerializedFileStream stream, long stringPosition)
        {
            Version = stream.ReadUInt16();
            Depth   = stream.ReadByte();
            IsArray = stream.ReadBoolean();
            uint type = stream.ReadUInt32();
            uint name = stream.ReadUInt32();

            ByteSize = stream.ReadInt32();
            Index    = stream.ReadInt32();
            MetaFlag = stream.ReadUInt32();

            Type = ReadString(stream, stringPosition, type);
            Name = ReadString(stream, stringPosition, name);
        }
        public void Read(SerializedFileStream stream)
        {
            ClassID = (ClassIDType)stream.ReadInt32();
            if (IsReadUnknown(stream.Generation))
            {
                Unknown  = stream.ReadByte();
                ScriptID = stream.ReadInt16();
            }

            if (IsReadHash(stream.Generation))
            {
                if (IsOldHashType(stream.Generation))
                {
                    if ((int)ClassID <= -1)
                    {
                        ScriptHash.Read(stream);
                    }
                }
                else
                {
                    if (ClassID == ClassIDType.MonoBehaviour)
                    {
                        ScriptHash.Read(stream);
                    }
                }
                TypeHash.Read(stream);
            }

            // isSerializeTypeTrees
            if (Tree != null)
            {
                Tree.Read(stream);
            }
        }
Ejemplo n.º 5
0
        public void Read(SerializedFileStream stream)
        {
            if (IsReadSignature(stream.Generation))
            {
                string signature = stream.ReadStringZeroTerm();
                Version.Parse(signature);
            }
            if (IsReadAttributes(stream.Generation))
            {
                Platform = (Platform)stream.ReadUInt32();
                if (!Enum.IsDefined(typeof(Platform), Platform))
                {
                    throw new Exception($"Unsuported platform {Platform} for asset file '{Name}'");
                }
            }
            if (IsReadSerializeTypeTrees(stream.Generation))
            {
                SerializeTypeTrees = stream.ReadBoolean();
            }
            else
            {
                SerializeTypeTrees = true;
            }
            m_types = stream.ReadArray(() => new RTTIBaseClassDescriptor(SerializeTypeTrees));

            if (IsReadUnknown(stream.Generation))
            {
                Unknown = stream.ReadInt32();
            }
        }
Ejemplo n.º 6
0
 public void Read(SerializedFileStream stream)
 {
     if (IsReadAssetName(stream.Generation))
     {
         AssetPath = stream.ReadStringZeroTerm();
     }
     if (IsReadHash(stream.Generation))
     {
         Hash.Read(stream);
         Type = (AssetType)stream.ReadInt32();
     }
     FilePath = stream.ReadStringZeroTerm();
 }
Ejemplo n.º 7
0
 public void Read(SerializedFileStream stream)
 {
     if (IsReadAssetName(stream.Generation))
     {
         AssetPath = stream.ReadStringZeroTerm();
     }
     if (IsReadHash(stream.Generation))
     {
         Hash.Read(stream);
         Type = (AssetType)stream.ReadInt32();
     }
     FilePathOrigin = stream.ReadStringZeroTerm();
     FilePath       = FilenameUtils.FixFileIdentifier(FilePathOrigin);
 }
Ejemplo n.º 8
0
        private static void ReadTreeNode(SerializedFileStream stream, ICollection <TypeTreeNode> nodes, byte depth)
        {
            TypeTreeNode node = new TypeTreeNode(depth);

            node.Read(stream);
            nodes.Add(node);

            int childCount = stream.ReadInt32();

            for (int i = 0; i < childCount; i++)
            {
                ReadTreeNode(stream, nodes, (byte)(depth + 1));
            }
        }
Ejemplo n.º 9
0
        public void Read(SerializedFileStream stream)
        {
            Hierarchy.Read(stream);

            int count = stream.ReadInt32();

            m_objects = new Dictionary <long, ObjectInfo>(count);
            for (int i = 0; i < count; i++)
            {
                ObjectInfo objectInfo = new ObjectInfo();
                objectInfo.Read(stream);
                m_objects.Add(objectInfo.PathID, objectInfo);
            }

            if (IsReadPreload(stream.Generation))
            {
                m_preloads = stream.ReadArray <ObjectPtr>();
            }
            m_dependencies = stream.ReadArray <FileIdentifier>();
            if (IsReadUnknown(stream.Generation))
            {
                Unknown = stream.ReadStringZeroTerm();
            }
        }