Exemplo n.º 1
0
        public void Read(SwfReader reader)
        {
            Name = reader.ReadMultiname();

            byte kind = reader.ReadUInt8();

            Kind       = (AbcTraitKind)(kind & 0x0F);
            Attributes = (AbcTraitAttributes)(kind >> 4);

            _slot.Read(reader);

            switch (_kind)
            {
            case AbcTraitKind.Method:
            case AbcTraitKind.Getter:
            case AbcTraitKind.Setter:
            case AbcTraitKind.Function:
                Method.Trait = this;
                break;

            case AbcTraitKind.Class:
                Class.Trait = this;
                break;
            }

            if ((Attributes & AbcTraitAttributes.HasMetadata) != 0)
            {
                _metadata = new AbcMetadata();
                int n = (int)reader.ReadUIntEncoded();
                for (int i = 0; i < n; ++i)
                {
                    int index = (int)reader.ReadUIntEncoded();
                    _metadata.Add(reader.ABC.Metadata[index]);
                }
            }
        }