public override IFrame ReadNotPublic(ClassData classData)
        {
            if (this.FrameType < 64 || this.FrameType > 127)
            {
                throw new InvalidFrameTypeException("Invalid FrameType :" + this.FrameType);
            }

            this.Stack = new VerificationTypeInfo().Read(classData);
            return(this);
        }
        public VerificationTypeInfo[] ReadVerificationTypeInfos(int count)
        {
            var verificationTypeInfos = new VerificationTypeInfo[count];

            for (var i = 0; i < count; i++)
            {
                verificationTypeInfos[i] = new VerificationTypeInfo().Read(_classData);
            }

            return(verificationTypeInfos);
        }
Beispiel #3
0
        public override IFrame ReadNotPublic(ClassData classData)
        {
            if (this.FrameType != 247)
            {
                throw new InvalidFrameTypeException("Invalid FrameType :" + this.FrameType);
            }

            this.OffsetDelta = classData.ReadUint16();
            this.Stack       = new VerificationTypeInfo().Read(classData);

            return(this);
        }
        public override CompileAttribute Read(EndianBinaryReader reader, List<CompileConstant> constants, int length)
        {
            Entries = new List<StackMapFrame>();

            short entryCount = reader.ReadInt16();
            for (int i = 0; i < entryCount; i++)
            {
                var entry = new StackMapFrame();

                entry.Type = reader.ReadByte();
                if (entry.Type <= 63)
                {
                    // SAME
                }
                else if (entry.Type >= 64 && entry.Type <= 127)
                {
                    // SAME_LOCALS_1_STACK_ITEM
                    var item = new VerificationTypeInfo();
                    item.Read(reader);

                    entry.Stack.Add(item);
                }
                else if (entry.Type == 247)
                {
                    // SAME_LOCALS_1_STACK_ITEM_EXTENDED
                    entry.OffsetDelta = reader.ReadInt16();

                    var item = new VerificationTypeInfo();
                    item.Read(reader);

                    entry.Stack.Add(item);
                }
                else if (entry.Type >= 248 && entry.Type <= 250)
                {
                    // CHOP
                    entry.OffsetDelta = reader.ReadInt16();
                }
                else if (entry.Type == 251)
                {
                    // SAME_FRAME_EXTENDED
                    entry.OffsetDelta = reader.ReadInt16();
                }
                else if (entry.Type >= 252 && entry.Type <= 254)
                {
                    // APPEND
                    entry.OffsetDelta = reader.ReadInt16();

                    var type = (short)entry.Type;
                    for (int x = 251; x < type; x++)
                    {
                        var item = new VerificationTypeInfo();
                        item.Read(reader);

                        entry.Locals.Add(item);
                    }
                }
                else if (entry.Type == 255)
                {
                    // FULL_FRAME
                    entry.OffsetDelta = reader.ReadInt16();

                    short localCount = reader.ReadInt16();
                    for (int x = 0; x < localCount; x++)
                    {
                        var item = new VerificationTypeInfo();
                        item.Read(reader);

                        entry.Locals.Add(item);
                    }

                    short stackCount = reader.ReadInt16();
                    for (int x = 0; x < stackCount; x++)
                    {
                        var item = new VerificationTypeInfo();
                        item.Read(reader);

                        entry.Stack.Add(item);
                    }
                }

                Entries.Add(entry);
            }

            return this;
        }