Пример #1
0
 public DebugIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     DebugType     = input.ReadByte();
     NameIndex     = input.ReadInt30();
     RegisterIndex = input.ReadByte();
     Extra         = input.ReadInt30();
 }
Пример #2
0
 public ASException(ABCFile abc, FlashReader input)
     : base(abc)
 {
     From               = input.ReadInt30();
     To                 = input.ReadInt30();
     Target             = input.ReadInt30();
     ExceptionTypeIndex = input.ReadInt30();
     VariableNameIndex  = input.ReadInt30();
 }
Пример #3
0
 public ASNamespaceSet(ASConstantPool pool, FlashReader input)
     : this(pool)
 {
     NamespaceIndices.Capacity = input.ReadInt30();
     for (int i = 0; i < NamespaceIndices.Capacity; i++)
     {
         int namespaceIndex = input.ReadInt30();
         NamespaceIndices.Add(namespaceIndex);
     }
 }
Пример #4
0
 public ASMetadata(ABCFile abc, FlashReader input)
     : this(abc)
 {
     NameIndex      = input.ReadInt30();
     Items.Capacity = input.ReadInt30();
     for (int i = 0; i < Items.Capacity; i++)
     {
         var itemInfo = new ASItemInfo(abc, input);
         Items.Add(itemInfo);
     }
 }
Пример #5
0
        public ASTrait(ABCFile abc, FlashReader input)
            : this(abc)
        {
            QNameIndex = input.ReadInt30();

            byte bitContainer = input.ReadByte();
            Kind       = (TraitKind)(bitContainer & 0x0F);
            Attributes = (TraitAttributes)(bitContainer >> 4);

            Id = input.ReadInt30();
            switch (Kind)
            {
            case TraitKind.Slot:
            case TraitKind.Constant:
            {
                TypeIndex  = input.ReadInt30();
                ValueIndex = input.ReadInt30();
                if (ValueIndex != 0)
                {
                    ValueKind = (ConstantKind)input.ReadByte();
                }
                break;
            }

            case TraitKind.Method:
            case TraitKind.Getter:
            case TraitKind.Setter:
            {
                MethodIndex  = input.ReadInt30();
                Method.Trait = this;
                break;
            }

            case TraitKind.Class:
            {
                ClassIndex = input.ReadInt30();
                break;
            }

            case TraitKind.Function:
            {
                FunctionIndex = input.ReadInt30();
                break;
            }
            }

            if (Attributes.HasFlag(TraitAttributes.Metadata))
            {
                MetadataIndices.Capacity = input.ReadInt30();
                for (int i = 0; i < MetadataIndices.Capacity; i++)
                {
                    int metadatumIndex = input.ReadInt30();
                    MetadataIndices.Add(metadatumIndex);
                }
            }
        }
Пример #6
0
        public ASMultiname(ASConstantPool pool, FlashReader input)
            : this(pool)
        {
            Kind = (MultinameKind)input.ReadByte();
            switch (Kind)
            {
            case MultinameKind.QName:
            case MultinameKind.QNameA:
            {
                NamespaceIndex = input.ReadInt30();
                NameIndex      = input.ReadInt30();
                break;
            }

            case MultinameKind.RTQName:
            case MultinameKind.RTQNameA:
            {
                NameIndex = input.ReadInt30();
                break;
            }

            case MultinameKind.RTQNameL:
            case MultinameKind.RTQNameLA:
            {
                /* No data. */
                break;
            }

            case MultinameKind.Multiname:
            case MultinameKind.MultinameA:
            {
                NameIndex         = input.ReadInt30();
                NamespaceSetIndex = input.ReadInt30();
                break;
            }

            case MultinameKind.MultinameL:
            case MultinameKind.MultinameLA:
            {
                NamespaceSetIndex = input.ReadInt30();
                break;
            }

            case MultinameKind.TypeName:
            {
                QNameIndex           = input.ReadInt30();
                TypeIndices.Capacity = input.ReadInt30();
                for (int i = 0; i < TypeIndices.Capacity; i++)
                {
                    int typeIndex = input.ReadInt30();
                    TypeIndices.Add(typeIndex);
                }
                break;
            }
            }
        }
Пример #7
0
        public ASClass(ABCFile abc, FlashReader input) : base(abc)
        {
            ConstructorIndex          = input.ReadInt30();
            Constructor.IsConstructor = true;
            Constructor.Container     = this;

            PopulateTraits(input);
        }
Пример #8
0
 private void PopulateList <T>(List <T> list, Func <int, T> reader, int count = -1)
 {
     list.Capacity = (count < 0 ? _input.ReadInt30() : count);
     for (int i = 0; i < list.Capacity; i++)
     {
         T value = reader(i);
         list.Add(value);
     }
 }
Пример #9
0
 public ASNamespace(ASConstantPool pool, FlashReader input)
     : base(pool)
 {
     Kind = (NamespaceKind)input.ReadByte();
     if (!Enum.IsDefined(typeof(NamespaceKind), Kind))
     {
         throw new InvalidCastException($"Invalid namespace kind for value {Kind:0x00}.");
     }
     NameIndex = input.ReadInt30();
 }
Пример #10
0
 public LookUpSwitchIns(FlashReader input)
     : this()
 {
     DefaultOffset        = input.ReadUInt24();
     CaseOffsets.Capacity = (input.ReadInt30() + 1);
     for (int i = 0; i < CaseOffsets.Capacity; i++)
     {
         CaseOffsets.Add(input.ReadUInt24());
     }
 }
Пример #11
0
        public ASInstance(ABCFile abc, FlashReader input)
            : this(abc)
        {
            QNameIndex = input.ReadInt30();
            SuperIndex = input.ReadInt30();
            Flags      = (ClassFlags)input.ReadByte();

            if (Flags.HasFlag(ClassFlags.ProtectedNamespace))
            {
                ProtectedNamespaceIndex = input.ReadInt30();
            }

            InterfaceIndices.Capacity = input.ReadInt30();
            for (int i = 0; i < InterfaceIndices.Capacity; i++)
            {
                int interfaceIndex = input.ReadInt30();
                InterfaceIndices.Add(interfaceIndex);
            }

            ConstructorIndex          = input.ReadInt30();
            Constructor.IsConstructor = true;
            Constructor.Container     = this;

            PopulateTraits(input);
        }
Пример #12
0
 private void PopulateList <T>(List <T> list, Func <T> reader, T defaultValue)
 {
     list.Capacity = _input.ReadInt30();
     if (list.Capacity > 0)
     {
         list.Add(defaultValue);
         for (int i = 1; i < list.Capacity; i++)
         {
             T value = reader();
             list.Add(value);
         }
     }
 }
Пример #13
0
        protected void PopulateTraits(FlashReader input)
        {
            Traits.Capacity = input.ReadInt30();
            for (int i = 0; i < Traits.Capacity; i++)
            {
                var trait = new ASTrait(ABC, input);
                trait.IsStatic = IsStatic;

                if (trait.Kind == TraitKind.Method ||
                    trait.Kind == TraitKind.Getter ||
                    trait.Kind == TraitKind.Setter)
                {
                    trait.Method.Container = this;
                }

                Traits.Add(trait);
            }
        }
Пример #14
0
        public ASMethodBody(ABCFile abc, FlashReader input) : this(abc)
        {
            MethodIndex = input.ReadInt30();
            Method.Body = this;

            MaxStack          = input.ReadInt30();
            LocalCount        = input.ReadInt30();
            InitialScopeDepth = input.ReadInt30();
            MaxScopeDepth     = input.ReadInt30();

            int codeLength = input.ReadInt30();
            Code = input.ReadBytes(codeLength);

            Exceptions.Capacity = input.ReadInt30();
            for (int i = 0; i < Exceptions.Capacity; i++)
            {
                var exception = new ASException(abc, input);
                Exceptions.Add(exception);
            }
            PopulateTraits(input);
        }
Пример #15
0
        public ASMethod(ABCFile abc, FlashReader input)
            : this(abc)
        {
            Parameters.Capacity = input.ReadInt30();
            ReturnTypeIndex     = input.ReadInt30();

            for (int i = 0; i < Parameters.Capacity; i++)
            {
                var parameter = new ASParameter(abc, this);
                parameter.TypeIndex = input.ReadInt30();
                Parameters.Add(parameter);
            }

            NameIndex = input.ReadInt30();
            Flags     = (MethodFlags)input.ReadByte();

            if (Flags.HasFlag(MethodFlags.HasOptional))
            {
                int optionalParamCount = input.ReadInt30();
                for (int i = (Parameters.Count - optionalParamCount);
                     optionalParamCount > 0;
                     i++, optionalParamCount--)
                {
                    ASParameter parameter = Parameters[i];
                    parameter.IsOptional = true;
                    parameter.ValueIndex = input.ReadInt30();
                    parameter.ValueKind  = (ConstantKind)input.ReadByte();
                }
            }

            if (Flags.HasFlag(MethodFlags.HasParamNames))
            {
                for (int i = 0; i < Parameters.Count; i++)
                {
                    ASParameter parameter = Parameters[i];
                    parameter.NameIndex = input.ReadInt30();
                }
            }
        }
Пример #16
0
 public CallPropVoidIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     PropertyNameIndex = input.ReadInt30();
     ArgCount          = input.ReadInt30();
 }
Пример #17
0
 public NewArrayIns(FlashReader input)
     : this()
 {
     ArgCount = input.ReadInt30();
 }
Пример #18
0
 public NewObjectIns(FlashReader input)
     : this()
 {
     ArgCount = input.ReadInt30();
 }
Пример #19
0
 public CallMethodIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     MethodIndex = input.ReadInt30();
     ArgCount    = input.ReadInt30();
 }
Пример #20
0
 public GetLexIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     TypeNameIndex = input.ReadInt30();
 }
Пример #21
0
 public PushStringIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     ValueIndex = input.ReadInt30();
 }
Пример #22
0
 public ASScript(ABCFile abc, FlashReader input)
     : base(abc)
 {
     InitializerIndex = input.ReadInt30();
     PopulateTraits(input);
 }
Пример #23
0
 public HasNext2Ins(FlashReader input)
     : this()
 {
     ObjectIndex   = input.ReadInt30();
     RegisterIndex = input.ReadInt30();
 }
Пример #24
0
 public DebugLineIns(FlashReader input)
     : this()
 {
     LineNumber = input.ReadInt30();
 }
Пример #25
0
 public ConstructPropIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     PropertyNameIndex = input.ReadInt30();
     ArgCount          = input.ReadInt30();
 }
Пример #26
0
 public SetSlotIns(FlashReader input)
     : this()
 {
     SlotIndex = input.ReadInt30();
 }
Пример #27
0
 public DeletePropertyIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     PropertyNameIndex = input.ReadInt30();
 }
Пример #28
0
 public NewFunctionIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     MethodIndex = input.ReadInt30();
 }
Пример #29
0
 public ApplyTypeIns(FlashReader input)
     : this()
 {
     ParamCount = input.ReadInt30();
 }
Пример #30
0
 public NewClassIns(ABCFile abc, FlashReader input)
     : this(abc)
 {
     ClassIndex = input.ReadInt30();
 }