Ejemplo n.º 1
0
        public RecordHeader(ShockwaveFlash flash)
        {
            _headerStart = flash.Position;
            _header      = flash.ReadUI16();
            _tag         = (FlashTagType)(_header >> 6);
            _length      = (uint)(_header & 0x3f);

            if (_length >= 63)
            {
                _length = flash.ReadUI32();
            }

            _headerEnd = flash.Position;
            _isLong    = (_length >= 0x3f);
        }
Ejemplo n.º 2
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.º 3
0
        public static byte[] ConstructTagData(FlashTagType tag, byte[] body, bool forceLong = false)
        {
            var  header = ((uint)tag) << 6;
            bool isLong = (forceLong || body.Length >= 0x3f);

            header |= (isLong ? 0x3f : (uint)body.Length);

            var buffer = new List <byte>();

            buffer.AddRange(BitConverter.GetBytes((ushort)header));
            if (isLong)
            {
                buffer.AddRange(BitConverter.GetBytes(body.Length));
            }

            buffer.AddRange(body);

            return(buffer.ToArray());
        }
Ejemplo n.º 4
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.º 5
0
 public FlashTag(FlashTagType tagType)
 {
     Header = new TagRecord(tagType);
 }
Ejemplo n.º 6
0
 public TagRecord(FlashTagType tagType)
 {
     TagType = tagType;
     Body = new byte[0];
 }
Ejemplo n.º 7
0
 public TagRecord(FlashTagType tagType)
 {
     TagType = tagType;
     Body    = new byte[0];
 }
Ejemplo n.º 8
0
 public FlashTag(FlashTagType tagType)
 {
     Header = new TagRecord(tagType);
 }