Beispiel #1
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();
 }
 public void Read(SerializedFileReader reader)
 {
     if (IsReadAssetName(reader.Generation))
     {
         AssetPath = reader.ReadStringZeroTerm();
     }
     if (IsReadHash(reader.Generation))
     {
         Hash.Read(reader);
         Type = (AssetType)reader.ReadInt32();
     }
     FilePathOrigin = reader.ReadStringZeroTerm();
     FilePath       = FilenameUtils.FixFileIdentifier(FilePathOrigin);
 }
        public void Read(SerializedFileReader reader)
        {
            if (IsReadSignature(reader.Generation))
            {
                string signature = reader.ReadStringZeroTerm();
                Version.Parse(signature);
            }
            if (IsReadAttributes(reader.Generation))
            {
                Platform = (Platform)reader.ReadUInt32();
                if (!Enum.IsDefined(typeof(Platform), Platform))
                {
                    throw new Exception($"Unsuported platform {Platform} for asset file '{Name}'");
                }
            }
            if (IsReadSerializeTypeTrees(reader.Generation))
            {
                SerializeTypeTrees = reader.ReadBoolean();
            }
            else
            {
                SerializeTypeTrees = true;
            }
            m_types = reader.ReadArray(() => new RTTIBaseClassDescriptor(SerializeTypeTrees));

            if (IsReadUnknown(reader.Generation))
            {
                Unknown = reader.ReadInt32();
            }
        }
Beispiel #4
0
        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)
        {
            Hierarchy.Read(reader);

            int count = reader.ReadInt32();

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

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