Exemplo n.º 1
0
        public void Read(SerializedFileReader reader)
        {
            Hierarchy.Read(reader);

            int count = reader.ReadInt32();
            Dictionary <long, AssetEntry> entries = new Dictionary <long, AssetEntry>(count);

            for (int i = 0; i < count; i++)
            {
                AssetEntry entry = new AssetEntry();
                entry.Read(reader, Hierarchy);
                entries.Add(entry.PathID, entry);
            }
            Entries = entries;

            if (IsReadPreload(reader.Generation))
            {
                Preloads = reader.ReadSerializedArray <ObjectPtr>();
            }
            Dependencies = reader.ReadSerializedArray <FileIdentifier>();
            if (IsReadUnknown(reader.Generation))
            {
                Unknown = reader.ReadStringZeroTerm();
            }
        }
        public void Read(SerializedFileReader reader)
        {
            if (IsReadSignature(reader.Generation))
            {
                string signature = reader.ReadStringZeroTerm();
                Version.Parse(signature);

#warning HACK: TEMP:
                if (Version == new Version(5, 6, 4, VersionType.Patch, 1))
                {
                    if (FilenameUtils.IsDefaultResource(Name))
                    {
                        Version = new Version(5, 6, 5, VersionType.Final);
                    }
                }
            }
            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;
            }
            Types = reader.ReadSerializedArray(() => new RTTIBaseClassDescriptor(SerializeTypeTrees));

            if (IsReadUnknown(reader.Generation))
            {
                Unknown = reader.ReadInt32();
            }
        }