Beispiel #1
0
 public static SwfShortHeader Read(SwfStreamReader reader)
 {
     return(new SwfShortHeader {
         Format = new string(reader.ReadChars(3)),
         Version = reader.ReadByte(),
         FileLength = reader.ReadUInt32()
     });
 }
Beispiel #2
0
        public override uint ReadUInt32()
        {
            var a = _first.ReadUInt32();
            var b = _second.ReadUInt32();

            if (a != b)
            {
                throw new Exception(string.Format("a={0}, b={1}", a, b));
            }
            return(a);
        }
        public static DefineBinaryDataTag Create(SwfStreamReader reader)
        {
            var tag = reader.ReadUInt16();

            reader.ReadUInt32();             // reserved
            var data = reader.ReadRest();

            return(new DefineBinaryDataTag {
                Tag = tag,
                Data = data
            });
        }
Beispiel #4
0
        public static SwfTagBase Read(SwfStreamReader reader)
        {
            var type_and_size = reader.ReadUInt16();
            var tag_id        = type_and_size >> 6;
            var short_size    = type_and_size & 0x3f;
            var size          = short_size < 0x3f ? (uint)short_size : reader.ReadUInt32();
            var tag_data      = reader.ReadBytes(size);

            return(Create(new SwfTagData {
                TagId = tag_id,
                TagData = tag_data
            }));
        }
Beispiel #5
0
        public static DoABCTag Create(SwfStreamReader reader)
        {
            const int kDoAbcLazyInitializeFlag = 1;
            var       flags     = reader.ReadUInt32();
            var       name      = reader.ReadString();
            var       abc_bytes = reader.ReadRest();

            return(new DoABCTag {
                ExecuteImmediately = (flags & kDoAbcLazyInitializeFlag) == 0,
                Name = name,
                ABCBytes = abc_bytes
            });
        }
Beispiel #6
0
        public void ReadUInt32Test()
        {
            var mem = new MemoryStream();

            mem.WriteByte(0x20);
            mem.WriteByte(0x71);
            mem.WriteByte(0x6e);
            mem.WriteByte(0x45);
            mem.Seek(0, SeekOrigin.Begin);
            var reader = new SwfStreamReader(mem);

            Assert.AreEqual(0x456e7120, reader.ReadUInt32(), "Value");

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }
Beispiel #7
0
        public void ReadUInt32Test()
        {
            var mem = new MemoryStream();
            mem.WriteByte(0x20);
            mem.WriteByte(0x71);
            mem.WriteByte(0x6e);
            mem.WriteByte(0x45);
            mem.Seek(0, SeekOrigin.Begin);
            var reader = new SwfStreamReader(mem);

            Assert.AreEqual(0x456e7120, reader.ReadUInt32(), "Value");

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }