public static void WriteFillStylesRGB(this ISwfStreamWriter writer, IList <FillStyleRGB> styles, bool allowBigArray) { if (styles.Count < 255) { writer.WriteByte((byte)styles.Count); } else { if (!allowBigArray) { throw new InvalidOperationException("DefineShape supports up to 255 fill style records"); } writer.WriteByte(255); writer.WriteUInt16((ushort)styles.Count); } foreach (var fillStyle in styles) { var style = fillStyle; writer.WriteFillStyleRGB(style); } }