示例#1
0
        public static void WriteClipActionRecord(this ISwfStreamWriter writer, byte swfVersion, ClipActionRecord record)
        {
            writer.WriteClipEventFlags(swfVersion, record.Flags);
            if (record.Flags.IsEmpty)
            {
                return;
            }

            var awmem = new MemoryStream();
            var aw    = new ActionWriter(new SwfStreamWriter(awmem));

            foreach (var action in record.Actions)
            {
                aw.WriteAction(action);
            }

            var size = awmem.Length + (record.Flags.ClipEventKeyPress ? 1 : 0);

            writer.WriteUInt32((uint)size);

            if (record.Flags.ClipEventKeyPress)
            {
                writer.WriteByte(record.KeyCode);
            }

            writer.WriteBytes(awmem.ToArray());
        }
示例#2
0
        public static void WriteTagData(this ISwfStreamWriter writer, SwfTagData data)
        {
            var bytes = data.Data;

            if (bytes.Length >= 0x3f)
            {
                writer.WriteUInt16((ushort)(((ushort)data.Type << 6) | 0x3f));
                writer.WriteUInt32((uint)bytes.Length);
            }
            else
            {
                writer.WriteUInt16((ushort)(((ushort)data.Type << 6) | bytes.Length));
            }
            writer.WriteBytes(bytes);
        }