public static IList <TextRecordRGB> ReadTextRecordsRGB(this ISwfStreamReader reader, uint glyphBits, uint advanceBits) { var res = new List <TextRecordRGB>(); bool isEnd; do { var record = new TextRecordRGB(); record.Type = reader.ReadBit(); record.Reserved = (byte)reader.ReadUnsignedBits(3); var hasFont = reader.ReadBit(); var hasColor = reader.ReadBit(); var hasYOffset = reader.ReadBit(); var hasXOffset = reader.ReadBit(); isEnd = !record.Type && record.Reserved == 0 && !hasFont && !hasColor && !hasYOffset && !hasXOffset; if (!isEnd) { record.FontID = hasFont ? (ushort?)reader.ReadUInt16() : null; if (hasColor) { record.TextColor = reader.ReadRGB(); } if (hasXOffset) { record.XOffset = reader.ReadSInt16(); } if (hasYOffset) { record.YOffset = reader.ReadSInt16(); } if (hasFont) { record.TextHeight = reader.ReadUInt16(); } var count = reader.ReadByte(); for (var i = 0; i < count; i++) { var entry = reader.ReadGlyphEntry(glyphBits, advanceBits); record.Glyphs.Add(entry); } reader.AlignToByte(); } res.Add(record); } while (!isEnd); return(res); }