Example #1
0
        public static DefineSceneAndFrameLabelDataTag Create(SwfStreamReader reader)
        {
            var scene_count = reader.ReadEncodedU32();
            var scenes      = new List <SceneOffsetData>((int)scene_count);

            for (var i = 0; i < scene_count; ++i)
            {
                scenes.Add(new SceneOffsetData {
                    Offset = reader.ReadEncodedU32(),
                    Name   = reader.ReadString()
                });
            }
            var frame_count = reader.ReadEncodedU32();
            var frames      = new List <FrameLabelData>((int)frame_count);

            for (var i = 0; i < frame_count; ++i)
            {
                frames.Add(new FrameLabelData {
                    Number = reader.ReadEncodedU32(),
                    Label  = reader.ReadString()
                });
            }
            return(new DefineSceneAndFrameLabelDataTag {
                Scenes = scenes,
                Frames = frames
            });
        }
Example #2
0
 public void ReadEncodedU32Bytes4Test()
 {
     var mem = new MemoryStream();
     WriteBits(mem, "10101000", "11110101", "10000100", "01000000");
     var reader = new SwfStreamReader(mem);
     var actual = reader.ReadEncodedU32();
     Assert.AreEqual(4, mem.Position);
     Assert.AreEqual(0x08013aa8, actual);
 }
Example #3
0
        public void ReadEncodedU32Bytes5Test()
        {
            var mem = new MemoryStream();

            WriteBits(mem, "10101000", "11110101", "10000100", "11000000", "00001010");
            var reader = new SwfStreamReader(mem);
            var actual = reader.ReadEncodedU32();

            Assert.AreEqual(5, mem.Position);
            Assert.AreEqual(0xa8013aa8, actual);
        }
Example #4
0
        public override uint ReadEncodedU32()
        {
            var a = _first.ReadEncodedU32();
            var b = _second.ReadEncodedU32();

            if (a != b)
            {
                throw new Exception(string.Format("a={0}, b={1}", a, b));
            }
            return(a);
        }