Ejemplo n.º 1
0
        public DefineBitsJPEG3(HeaderRecord header, FlashReader input)
            : base(header)
        {
            Id = input.ReadUInt16();

            int alphaDataOffset = input.ReadInt32();

            Data = input.ReadBytes(alphaDataOffset);

            Format = GetFormat(Data);
            if (Format == ImageFormat.JPEG)
            {
                int partialLength = (2 + 4 + alphaDataOffset);
                AlphaData = input.ReadBytes(Header.Length - partialLength);
            }
        }
 public DefineBinaryDataTag(HeaderRecord header, FlashReader input)
     : base(header)
 {
     Id = input.ReadUInt16();
     input.ReadUInt32(); // Reserved | Must equal '0'.
     Data = input.ReadBytes(header.Length - 6);
 }
Ejemplo n.º 3
0
        public ASMethodBody(ABCFile abc, FlashReader reader)
            : this(abc)
        {
            MethodIndex       = reader.Read7BitEncodedInt();
            MaxStack          = reader.Read7BitEncodedInt();
            LocalCount        = reader.Read7BitEncodedInt();
            InitialScopeDepth = reader.Read7BitEncodedInt();
            MaxScopeDepth     = reader.Read7BitEncodedInt();

            int bytecodeLength = reader.Read7BitEncodedInt();
            Bytecode = reader.ReadBytes(bytecodeLength);

            Exceptions.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Exceptions.Capacity; i++)
            {
                Exceptions.Add(new ASException(abc, reader));
            }

            Traits.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Traits.Capacity; i++)
            {
                Traits.Add(new ASTrait(abc, reader));
            }

            Method.Body = this;
        }
Ejemplo n.º 4
0
        public DefineBinaryDataTag(FlashReader reader, TagRecord header)
            : base(reader, header)
        {
            CharacterId = reader.ReadUInt16();
            reader.ReadUInt32();

            BinaryData = reader.ReadBytes(header.Body.Length - 6);
        }
Ejemplo n.º 5
0
        public DoABCTag(HeaderRecord header, FlashReader input)
            : base(header)
        {
            Flags = input.ReadUInt32();
            Name  = input.ReadNullString();

            int partialLength = (Encoding.UTF8.GetByteCount(Name) + 5);

            ABCData = input.ReadBytes(header.Length - partialLength);
        }
Ejemplo n.º 6
0
 public DefineSoundTag(HeaderRecord header, FlashReader input)
     : base(header)
 {
     Id               = input.ReadUInt16();
     Format           = input.ReadUB(4);
     Rate             = input.ReadUB(2);
     Size             = input.ReadUB(1);
     SoundType        = input.ReadUB(1);
     SoundSampleCount = input.ReadUInt32();
     SoundData        = input.ReadBytes(header.Length - 7);
 }
Ejemplo n.º 7
0
        public DefineBitsJPEG3(HeaderRecord header, FlashReader input) : base(header)
        {
            Id = input.ReadUInt16();

            var alphaDataOffset = input.ReadInt32();

            Data   = input.ReadBytes(alphaDataOffset);
            Format = GetFormat(Data);

            if (Format == ImageFormat.JPEG)
            {
                var partialLength = 2 + 4 + alphaDataOffset;
                AlphaData = input.ReadBytes(Header.Length - partialLength);
            }
            else
            {
                // Minimum Compressed Empty Data Length
                AlphaData = input.ReadBytes(8);
            }
        }
Ejemplo n.º 8
0
        public DoABCTag(FlashReader reader, TagRecord header)
            : base(reader, header)
        {
            Flags = reader.ReadUInt32();
            Name  = reader.ReadNullTerminatedString();

            int nameLength = (Encoding.UTF8.GetByteCount(Name) + 1);

            byte[] abcData = reader.ReadBytes(header.Body.Length - (nameLength + 4));

            ABC = new ABCFile(abcData);
        }
        public DefineBitsLossless2Tag(HeaderRecord header, FlashReader input) : base(header)
        {
            Id     = input.ReadUInt16();
            Format = input.ReadByte();
            Width  = input.ReadUInt16();
            Height = input.ReadUInt16();

            if (Format == Format8BitColormapped)
            {
                ColorTableSize = input.ReadByte();
            }

            var readSize = 7 + (Format == Format8BitColormapped ? 1 : 0);

            _zlibData = input.ReadBytes(header.Length - readSize);
        }
Ejemplo n.º 10
0
        public DefineBitsLossless2Tag(HeaderRecord header, FlashReader input)
            : base(header)
        {
            Id      = input.ReadUInt16();
            _format = input.ReadByte();

            _width  = input.ReadUInt16();
            _height = input.ReadUInt16();

            if (_format == 3)
            {
                _colorTableSize = input.ReadByte();
            }

            int partialLength = (7 + (_format == 3 ? 1 : 0));

            _compressedBitmapData = input.ReadBytes(header.Length - partialLength);
        }
Ejemplo n.º 11
0
        public TagRecord(FlashReader reader)
        {
            Start = reader.Position;

            ushort header = reader.ReadUInt16();

            TagType = (FlashTagType)(header >> 6);

            int length = (header & 63);

            if (length >= 63)
            {
                length        = reader.ReadInt32();
                IsSpecialLong = (length < 63);
            }
            BodyStart = reader.Position;

            Body            = reader.ReadBytes(length);
            reader.Position = BodyStart;
        }
Ejemplo n.º 12
0
        public DefineBitsLossless2Tag(HeaderRecord header, FlashReader input)
            : base(header)
        {
            Id      = input.ReadUInt16();
            _format = input.ReadByte();

            ushort width  = input.ReadUInt16();
            ushort height = input.ReadUInt16();

            _argbMap = new Color[width, height];

            if (_format == 3)
            {
                _colorTableSize = input.ReadByte();
            }

            int partialLength = (7 + (_format == 3 ? 1 : 0));

            _compressedData = input.ReadBytes(header.Length - partialLength);
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
        public DefineBitsLossless2Tag(FlashReader reader, TagRecord header) :
            base(reader, header)
        {
            CharacterId  = reader.ReadUInt16();
            BitmapFormat = reader.ReadByte();
            BitmapWidth  = reader.ReadUInt16();
            BitmapHeight = reader.ReadUInt16();

            _isCompressed = true;
            switch (BitmapFormat - 3)
            {
            case 0: break;

            case 1:
            case 2:
            {
                _compressedBitmapData =
                    reader.ReadBytes(header.Body.Length - 7);

                break;
            }
            }
        }
Ejemplo n.º 15
0
 public UnknownTag(HeaderRecord header, FlashReader input)
     : base(header)
 {
     Data = input.ReadBytes(header.Length);
 }