Ejemplo n.º 1
0
 public void Load(AssetReader reader)
 {
     PathId = reader.ReadId();
     Offset = reader.ReadUInt32() + Asset.DataOffset;
     Size   = reader.ReadUInt32();
     if (Asset.Format < 17)
     {
         TypeId  = reader.ReadInt32();
         ClassId = reader.ReadInt16();
     }
     else
     {
         var type_id  = reader.ReadInt32();
         var class_id = Asset.Tree.ClassIds[type_id];
         TypeId  = class_id;
         ClassId = class_id;
     }
     if (Asset.Format <= 10)
     {
         IsDestroyed = reader.ReadInt16() != 0;
     }
     if (Asset.Format >= 11 && Asset.Format < 17)
     {
         reader.ReadInt16();
     }
     if (Asset.Format >= 15 && Asset.Format < 17)
     {
         reader.ReadByte();
     }
 }
Ejemplo n.º 2
0
        public void Load(AssetReader reader)
        {
            int format = reader.Format;

            m_version = reader.ReadCString();
            var platform = reader.ReadInt32();

            if (format >= 13)
            {
                bool has_type_trees = reader.ReadBool();
                int  count          = reader.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    int class_id = reader.ReadInt32();
                    if (format >= 17)
                    {
                        reader.ReadByte();
                        int script_id = reader.ReadInt16();
                        if (114 == class_id)
                        {
                            if (script_id >= 0)
                            {
                                class_id = -2 - script_id;
                            }
                            else
                            {
                                class_id = -1;
                            }
                        }
                    }
                    m_class_ids.Add(class_id);
                    byte[] hash = reader.ReadBytes(class_id < 0 ? 0x20 : 0x10);
                    m_hashes[class_id] = hash;
                    if (has_type_trees)
                    {
                        var tree = new TypeTree(format);
                        tree.Load(reader);
                        m_type_trees[class_id] = tree;
                    }
                }
            }
            else
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    int class_id = reader.ReadInt32();
                    var tree     = new TypeTree(format);
                    tree.Load(reader);
                    m_type_trees[class_id] = tree;
                }
            }
        }