Ejemplo n.º 1
0
        /// <summary>
        /// Initializes new instance of <see cref="AbcFile"/> class.
        /// </summary>
        public AbcFile()
        {
            IntPool       = new AbcConstPool <int>();
            UIntPool      = new AbcConstPool <uint>();
            DoublePool    = new AbcConstPool <double>();
            StringPool    = new AbcConstPool <string>();
            Namespaces    = new AbcNamespacePool(this);
            NamespaceSets = new AbcNssetPool(this);
            Multinames    = new AbcMultinamePool(this);

            Methods      = new AbcMethodCollection(this);
            Metadata     = new AbcMetadata();
            Classes      = new AbcClassCollection();
            Instances    = new AbcInstanceCollection(this);
            Scripts      = new AbcScriptCollection(this);
            MethodBodies = new AbcMethodBodyCollection();
        }
Ejemplo n.º 2
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]);
                }
            }
        }