internal DefineSprite(ulong length, SwfBitStream swfStream) : base(TagCode, length) { SpriteID = swfStream.GetUInt16(); FrameCount = swfStream.GetUInt16(); var tags = new List<SwfTag>(); var startBytes = swfStream.BytesRead; do { tags.Add(ParseTag(swfStream)); } while (swfStream.BytesRead - startBytes < Length); ControlTags = tags.ToArray(); }
internal GenericTag(ushort code, ulong length, SwfBitStream swfStream) : base(code, length) { Data = swfStream.GetBytes((uint)length); }
internal static SwfTag ParseTag(SwfBitStream swfStream) { const ushort low6 = 63; var codeAndLength = swfStream.GetUInt16(); var code = (ushort)((codeAndLength & ~low6) >> 6); var length = (uint)(codeAndLength & low6); var longTag = length == 0x3F; if (longTag) { length = swfStream.GetUInt32(); } switch (code) { case DefineSprite.TagCode: return new DefineSprite(length, swfStream); default: return new GenericTag(code, length, swfStream); } }