RecordHeader object represents swf tag headers.

The Swf format is composed of a series of tagged data blocks. All tag begins with record header informations.

A record header object contains the current tag code and the size of the tag in bytes.

You don't need to instance this object, to construct a tag. Record header management is automatically done on the reading or the writing process of a tag.

Exemplo n.º 1
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
            {
                return;
            }

            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(characterId);
            if (jpegData != null)
            {
                w.Write(Convert.ToUInt32(jpegData.Length));
            }
            else
            {
                w.Write((int)0);
            }
            if (jpegData != null)
            {
                w.Write(jpegData);
            }
            if (alphaData != null)
            {
                w.Write(alphaData);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 2
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            fontId = binaryReader.ReadUInt16();
            byte fontNameLen = binaryReader.ReadByte();

            fontName = binaryReader.ReadString(fontNameLen);

            binaryReader.ReadUBits(2); //reserved
            fontFlagsSmallText = binaryReader.ReadBoolean();
            binaryReader.ReadUBits(2); //not used
            fontFlagsItalic = binaryReader.ReadBoolean();
            fontFlagsBold   = binaryReader.ReadBoolean();
            binaryReader.ReadBoolean(); //not used

            languageCode = binaryReader.ReadByte();

            long codeTableLenght = rh.TagLength - 5 - fontNameLen;

            codeTable = null;
            codeTable = new ushort[codeTableLenght];
            for (int i = 0; i < codeTableLenght / 2; i++)
            {
                codeTable[i] = binaryReader.ReadUInt16();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);

            w.Write(this.soundId);
            w.WriteUBits(soundFormat, 4);
            w.WriteUBits(soundRate, 2);
            w.WriteUBits(soundSize, 1);
            w.WriteUBits(soundType, 1);

            w.Write(this.soundSampleCount);
            if (soundData != null)
            {
                w.Write(this.soundData);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 4
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 6)
            {
                return;
            }

            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);

            w.Write(this.characterId);
            w.Write(this.numFrames);
            w.Write(this.width);
            w.Write(this.height);

            w.WriteUBits(0, 5);
            w.WriteUBits(videoFlagsDeblocking, 2);
            w.WriteBoolean(videoFlagsSmoothing);

            w.Write(this.codecId);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 5
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.fontId);

            //TODO: calcule offset !!
            if (offsetTable != null)
            {
                IEnumerator offsets = offsetTable.GetEnumerator();
                while (offsets.MoveNext())
                {
                    w.Write((ushort)offsets.Current);
                }
            }

            ShapeWithStyle.NumFillBits = 0;
            ShapeWithStyle.NumLineBits = 0;
            glyphShapesTable.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 6
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
            {
                return;
            }

            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf(version));

            rh.WriteTo(w);

            if (name != null)
            {
                w.WriteString(name, (uint)name.Length);
            }
            if (version >= 6)
            {
                w.Write((byte)1);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 7
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);

            w.WriteUBits(0, 4);
            w.WriteUBits(playbackSoundRate, 2);
            w.WriteUBits(playbackSoundSize, 1);
            w.WriteUBits(playbackSoundType, 1);
            w.SynchBits();
            w.WriteUBits(streamSoundCompression, 4);
            w.WriteUBits(streamSoundRate, 2);
            w.WriteUBits(streamSoundSize, 1);
            w.WriteUBits(streamSoundType, 1);

            w.Write(streamSoundSampleCount);
            if (streamSoundCompression == 2)
            {
                w.Write(latencySeek);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 8
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 2)
            {
                return;
            }

            // Compression process
            int lenghtOfCompressedBlock = 0;

            byte[]               compressArray      = null;
            MemoryStream         unCompressedStream = new MemoryStream();
            BufferedBinaryWriter unCompressedWriter = new BufferedBinaryWriter(unCompressedStream);

            if (this._bitmapFormat == 3)
            {
                this._colorMapData.WriteTo(unCompressedWriter);
            }
            else if (this._bitmapFormat == 4 || this._bitmapFormat == 5)
            {
                this._bitmapColorData.WriteTo(unCompressedWriter);
            }

            MemoryStream         compressedStream = new MemoryStream();
            DeflaterOutputStream ouput            = new DeflaterOutputStream(compressedStream);

            byte[] unCompressArray = unCompressedStream.ToArray();
            ouput.Write(unCompressArray, 0, unCompressArray.Length);
            ouput.Finish();
            compressArray           = compressedStream.ToArray();
            lenghtOfCompressedBlock = compressArray.Length;
            ouput.Close();
            unCompressedStream.Close();

            //Writing process
            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf(lenghtOfCompressedBlock));

            rh.WriteTo(w);
            w.Write(this._characterId);
            w.Write(this._bitmapFormat);
            w.Write(this._bitmapWidth);
            w.Write(this._bitmapHeight);

            if (this._bitmapFormat == 3)
            {
                w.Write(this._bitmapColorTableSize);
                w.Write(compressArray);
            }
            else if (this._bitmapFormat == 4 || this._bitmapFormat == 5)
            {
                w.Write(compressArray);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 9
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.buttonId);
            if (characters != null)
            {
                foreach (ButtonRecord buttRec in characters)
                {
                    buttRec.WriteTo(w, TagCodeEnum.DefineButton);
                }
            }
            byte end = 0;

            w.Write(end);
            if (actions != null)
            {
                w.Write(actions);
            }
            w.Write(end);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 10
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            depth = binaryReader.ReadUInt16();
        }
Exemplo n.º 11
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            int tl = System.Convert.ToInt32(rh.TagLength);
            Meta = binaryReader.ReadString();
        }
Exemplo n.º 12
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            int lenght = System.Convert.ToInt32(rh.TagLength);
            password = binaryReader.ReadString();
            //char[] password = br.ReadChars(lenght);
        }
Exemplo n.º 13
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            rgb = new RGB();
            rgb.ReadData(binaryReader);
        }
Exemplo n.º 14
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            int lenght = System.Convert.ToInt32(rh.TagLength);

            actionRecord = binaryReader.ReadBytes(lenght);
        }
Exemplo n.º 15
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            soundId   = binaryReader.ReadUInt16();
            soundInfo = new SoundInfo();
            soundInfo.ReadData(binaryReader);
        }
Exemplo n.º 16
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            buttonId             = binaryReader.ReadUInt16();
            buttonColorTransform = new CXForm();
            buttonColorTransform.ReadData(binaryReader);
        }
Exemplo n.º 17
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            shapeId = binaryReader.ReadUInt16();
            rect.ReadData(binaryReader);
            shape.ReadData(binaryReader, this.shapeType);
        }
Exemplo n.º 18
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            int tl = System.Convert.ToInt32(rh.TagLength);

            jpegData = binaryReader.ReadBytes(tl);
        }
Exemplo n.º 19
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            soundData = new byte[rh.TagLength];
            for (uint i = 0; i < rh.TagLength; i++)
            {
                soundData[i] = binaryReader.ReadByte();
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
            {
                return;
            }

            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.characterId);

            w.SynchBits();
            if (this.startBounds != null)
            {
                this.startBounds.WriteTo(w);
            }
            w.SynchBits();
            if (this.endBounds != null)
            {
                this.endBounds.WriteTo(w);
            }

            w.Write(this.offset);
            if (this.morphFillStyles != null)
            {
                this.morphFillStyles.WriteTo(w);
            }
            if (this.morphLineStyles != null)
            {
                this.morphLineStyles.WriteTo(w);
            }

            ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count;
            ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count;

            if (this.startEdges != null)
            {
                this.startEdges.WriteTo(w);
            }
            if (this.endEdges != null)
            {
                this.endEdges.WriteTo(w);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 21
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, 0);

            rh.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 22
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            int tl = System.Convert.ToInt32(rh.TagLength);

            characterId = binaryReader.ReadUInt16();
            if (tl - 2 > 0)
            {
                jpegData = binaryReader.ReadBytes(tl - 2);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
            {
                return;
            }

            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.buttonId);
            w.WriteUBits(0, 7);
            w.WriteBoolean(trackAsMenu);
            w.Write(this.actionOffset);
            if (characters != null)
            {
                IEnumerator butts = characters.GetEnumerator();
                while (butts.MoveNext())
                {
                    ((ButtonRecord)butts.Current).WriteTo(w, TagCodeEnum.DefineButton2);
                    w.SynchBits();
                }
            }
            w.Write((byte)0);
            if (actions != null)
            {
                for (int i = 0; i < actions.Count; i++)
                {
                    ButtonCondaction buttCon = actions[i];
                    if (i == actions.Count - 1)
                    {
                        w.Write((ushort)0);
                    }
                    else
                    {
                        int size = buttCon.GetSizeOf();
                        w.Write((ushort)size);
                    }
                    buttCon.WriteTo(w);
                }
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 24
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            if (Meta != null)
                w.Write(Meta);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 25
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            characterId = binaryReader.ReadUInt16();
            numFrames   = binaryReader.ReadUInt16();
            width       = binaryReader.ReadUInt16();
            height      = binaryReader.ReadUInt16();
            binaryReader.ReadUBits(5);
            videoFlagsDeblocking = binaryReader.ReadUBits(2);
            videoFlagsSmoothing  = binaryReader.ReadBoolean();
            codecId = binaryReader.ReadByte();
        }
Exemplo n.º 26
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            int tl    = System.Convert.ToInt32(rh.TagLength);
            int count = binaryReader.ReadUInt16();

            for (int i = 0; i < count; i++)
            {
                int    id   = binaryReader.ReadUInt16();
                string name = binaryReader.ReadString(Encoding.UTF8);
                tagsData.Add(id, name);
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            if (jpegData != null)
            {
                w.Write(jpegData);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 28
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            uint max = rh.TagLength;

            if (version >= 6)
            {
                max--;
            }
            name = binaryReader.ReadString(max);
            if (version >= 6)
            {
                binaryReader.ReadByte();
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            // inner tags
            long endPos = binaryReader.BaseStream.Position + rh.TagLength;

            // stuff before inner tags, just read it and dont look any further
            spriteId   = binaryReader.ReadUInt16();
            frameCount = binaryReader.ReadUInt16();

            while (binaryReader.BaseStream.Position < endPos)
            {
                BaseTag b = SwfReader.ReadTag(version, binaryReader, this.tagList);
                this.tagList.Add(b);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);

            w.Write(fontId);
            w.Write((byte)fontName.Length);
            if (fontName != null)
            {
                w.WriteString(fontName, (uint)fontName.Length);
            }

            w.WriteUBits(0, 2); //reserved
            w.WriteBoolean(fontFlagsSmallText);
            w.WriteBoolean(fontFlagsShiftJIS);
            w.WriteBoolean(fontFlagsAINSI);
            w.WriteBoolean(fontFlagsItalic);
            w.WriteBoolean(fontFlagsBold);
            w.WriteBoolean(fontFlagsWildCodes);

            if (!fontFlagsWildCodes)
            {
                for (int i = 0; i < codeTable.Length; i++)
                {
                    w.Write((byte)codeTable[i]);
                }
            }
            else
            {
                for (int i = 0; i < codeTable.Length; i++)
                {
                    w.Write((ushort)codeTable[i]);
                }
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 31
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 2)
            {
                return;
            }

            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.buttonId);

            w.Write(this.buttonSoundChar);
            if (buttonSoundChar != 0 && buttonSoundInfo != null)
            {
                buttonSoundInfo.WriteTo(w);
            }

            w.Write(this.buttonSoundChar1);
            if (buttonSoundChar1 != 0 && buttonSoundInfo1 != null)
            {
                buttonSoundInfo1.WriteTo(w);
            }

            w.Write(this.buttonSoundChar2);
            if (buttonSoundChar2 != 0 && buttonSoundInfo2 != null)
            {
                buttonSoundInfo2.WriteTo(w);
            }

            w.Write(this.buttonSoundChar3);
            if (buttonSoundChar3 != 0 && buttonSoundInfo3 != null)
            {
                buttonSoundInfo3.WriteTo(w);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 32
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="version">Version.</param>
        /// <param name="binaryReader">Binary reader.</param>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();

            rh.ReadData(binaryReader);

            ushort count = binaryReader.ReadUInt16();

            exportedCharacters.Clear();
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Assert exportedCharacter = new Assert();
                    exportedCharacter.ReadData(binaryReader);
                    this.exportedCharacters.Add(exportedCharacter);
                }
            }
        }
Exemplo n.º 33
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf(version));
            rh.WriteTo(w);

            if (name != null)
                w.WriteString(name, (uint)name.Length);
            if (version >= 6)
                w.Write((byte)1);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 34
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.characterId);

            w.SynchBits();
            if (this.startBounds != null)
                this.startBounds.WriteTo(w);
            w.SynchBits();
            if (this.endBounds != null)
                this.endBounds.WriteTo(w);

            w.Write(this.offset);
            if (this.morphFillStyles != null)
                this.morphFillStyles.WriteTo(w);
            if (this.morphLineStyles != null)
                this.morphLineStyles.WriteTo(w);

            ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count;
            ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count;

            if (this.startEdges != null)
                this.startEdges.WriteTo(w);
            if (this.endEdges != null)
                this.endEdges.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 35
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            w.Write(this.soundId);
            w.WriteUBits(soundFormat, 4);
            w.WriteUBits(soundRate, 2);
            w.WriteUBits(soundSize, 1);
            w.WriteUBits(soundType, 1);

            w.Write(this.soundSampleCount);
            if (soundData != null)
                w.Write(this.soundData);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 36
0
 /// <summary>
 /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
 /// </summary>
 public override void ReadData(byte version, BufferedBinaryReader binaryReader)
 {
     RecordHeader rh = new RecordHeader();
     rh.ReadData(binaryReader);
 }
Exemplo n.º 37
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 2)
                return;

            // Compression process
            int lenghtOfCompressedBlock = 0;
            byte[] compressArray = null;
            MemoryStream unCompressedStream = new MemoryStream();
            BufferedBinaryWriter unCompressedWriter = new BufferedBinaryWriter(unCompressedStream);

            if (this._bitmapFormat == 3)
            {
                this._colorMapData.WriteTo(unCompressedWriter);
            }
            else if (this._bitmapFormat == 4 || this._bitmapFormat == 5)
            {
                this._bitmapColorData.WriteTo(unCompressedWriter);
            }

            MemoryStream compressedStream = new MemoryStream();
            DeflaterOutputStream ouput = new DeflaterOutputStream(compressedStream);
            byte[] unCompressArray = unCompressedStream.ToArray();
            ouput.Write(unCompressArray, 0, unCompressArray.Length);
            ouput.Finish();
            compressArray = compressedStream.ToArray();
            lenghtOfCompressedBlock = compressArray.Length;
            ouput.Close();
            unCompressedStream.Close();

            //Writing process
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf(lenghtOfCompressedBlock));

            rh.WriteTo(w);
            w.Write(this._characterId);
            w.Write(this._bitmapFormat);
            w.Write(this._bitmapWidth);
            w.Write(this._bitmapHeight);

            if (this._bitmapFormat == 3)
            {
                w.Write(this._bitmapColorTableSize);
                w.Write(compressArray);
            }
            else if (this._bitmapFormat == 4 || this._bitmapFormat == 5)
            {
                w.Write(compressArray);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 38
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 2)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.buttonId);

            w.Write(this.buttonSoundChar);
            if (buttonSoundChar != 0 && buttonSoundInfo != null)
                buttonSoundInfo.WriteTo(w);

            w.Write(this.buttonSoundChar1);
            if (buttonSoundChar1 != 0 && buttonSoundInfo1 != null)
                buttonSoundInfo1.WriteTo(w);

            w.Write(this.buttonSoundChar2);
            if (buttonSoundChar2 != 0 && buttonSoundInfo2 != null)
                buttonSoundInfo2.WriteTo(w);

            w.Write(this.buttonSoundChar3);
            if (buttonSoundChar3 != 0 && buttonSoundInfo3 != null)
                buttonSoundInfo3.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 39
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            long startPosition = binaryReader.BaseStream.Position;

            buttonId = binaryReader.ReadUInt16();
            binaryReader.ReadUBits(7); //reserved
            trackAsMenu = binaryReader.ReadBoolean();

            long startPos = binaryReader.BaseStream.Position;

            actionOffset = binaryReader.ReadUInt16();

            if (characters == null)
                characters = new ButtonRecordCollection();
            else
                characters.Clear();

            bool characterEndFlag = false;
            while (!characterEndFlag)
            {
                byte first = binaryReader.ReadByte();
                if (first == 0)
                    characterEndFlag = true;
                else
                {
                    ButtonRecord buttRecord = new ButtonRecord();
                    buttRecord.ReadData(binaryReader, first, TagCodeEnum.DefineButton2);
                    characters.Add(buttRecord);
                }
            }

            long curr = startPos + actionOffset;

            actions = new ButtonCondactionCollection();
            bool lastCondAction = false;
            if (actionOffset == 0)
                lastCondAction = true;

            while (!lastCondAction)
            {
                long readedBytes = binaryReader.BaseStream.Position - startPosition;
                ushort condActionSize = binaryReader.ReadUInt16();
                if (condActionSize == 0)
                {
                    lastCondAction = true;
                    condActionSize = (ushort)(rh.TagLength - readedBytes);
                }
                ButtonCondaction buttCond = new ButtonCondaction();
                buttCond.ReadData(binaryReader, condActionSize);
                actions.Add(buttCond);
            }
        }
Exemplo n.º 40
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            w.Write(characterId);
            w.Write(depth);
            if (this.matrix != null)
                this.matrix.WriteTo(w);
            if (this.colorTransform != null)
                this.colorTransform.WriteTo(w);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 41
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            buttonId = binaryReader.ReadUInt16();

            buttonSoundChar = binaryReader.ReadUInt16();
            buttonSoundInfo = null;
            if (buttonSoundChar != 0)
            {
                buttonSoundInfo = new SoundInfo();
                buttonSoundInfo.ReadData(binaryReader);
            }
            buttonSoundChar1 = binaryReader.ReadUInt16();
            buttonSoundInfo1 = null;
            if (buttonSoundChar1 != 0)
            {
                buttonSoundInfo1 = new SoundInfo();
                buttonSoundInfo1.ReadData(binaryReader);
            }
            buttonSoundChar2 = binaryReader.ReadUInt16();
            buttonSoundInfo2 = null;
            if (buttonSoundChar2 != 0)
            {
                buttonSoundInfo2 = new SoundInfo();
                buttonSoundInfo2.ReadData(binaryReader);
            }
            buttonSoundChar3 = binaryReader.ReadUInt16();
            buttonSoundInfo3 = null;
            if (buttonSoundChar3 != 0)
            {
                buttonSoundInfo3 = new SoundInfo();
                buttonSoundInfo3.ReadData(binaryReader);
            }
        }
Exemplo n.º 42
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            long initPos = binaryReader.BaseStream.Position;

            characterId = binaryReader.ReadUInt16();
            depth = binaryReader.ReadUInt16();
            matrix = new Matrix();
            matrix.ReadData(binaryReader);

            long pos = binaryReader.BaseStream.Position - initPos;
            if (pos < rh.TagLength)
            {
                colorTransform = new CXForm();
                colorTransform.ReadData(binaryReader);
            }
        }
Exemplo n.º 43
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, 4);
            rh.WriteTo(w);

            w.Write(characterId);
            w.Write(depth);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 44
0
 /// <summary>
 /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
 /// </summary>
 public override void ReadData(byte version, BufferedBinaryReader binaryReader)
 {
     RecordHeader rh = new RecordHeader();
     rh.ReadData(binaryReader);
     characterId = binaryReader.ReadUInt16();
     depth = binaryReader.ReadUInt16();
 }
Exemplo n.º 45
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="version">Version.</param>
        /// <param name="binaryReader">Binary reader.</param>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            ushort count = binaryReader.ReadUInt16();
            exportedCharacters.Clear();
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Assert exportedCharacter = new Assert();
                    exportedCharacter.ReadData(binaryReader);
                    this.exportedCharacters.Add(exportedCharacter);
                }
            }
        }
Exemplo n.º 46
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            int beforePos = (int)binaryReader.BaseStream.Position;
            int toReaded = (int)rh.TagLength - 7;

            _characterId = binaryReader.ReadUInt16();
            _bitmapFormat = binaryReader.ReadByte();
            _bitmapWidth = binaryReader.ReadUInt16();
            _bitmapHeight = binaryReader.ReadUInt16();
            _bitmapColorTableSize = 0;

            if (_bitmapFormat == 3)
            {
                _bitmapColorTableSize = binaryReader.ReadByte();
                toReaded--;
            }

            int imageSize = _bitmapWidth * _bitmapHeight;

            if (_bitmapFormat == 3)
            {
                int uncompressedSize = imageSize + ((_bitmapColorTableSize + 1) * 4);
                byte[] uncompressed = new byte[uncompressedSize];
                byte[] compressed = binaryReader.ReadBytes(toReaded);
                Inflater zipInflator = 	new Inflater();
                zipInflator.SetInput(compressed);
                zipInflator.Inflate(uncompressed, 0, uncompressedSize);

                _alphaColorMapData = new AlphaColorMapData();
                _alphaColorMapData.ColorTableRgb = new RGBA[_bitmapColorTableSize + 1];
                int offset = 0;
                for (int i = 0; i < _bitmapColorTableSize + 1; i++, offset += 4)
                {
                    byte red = uncompressed[offset];
                    byte green = uncompressed[offset + 1];
                    byte blue = uncompressed[offset + 2];
                    byte alpha = uncompressed[offset + 3];
                    _alphaColorMapData.ColorTableRgb[i] = new RGBA(red, green, blue, alpha);
                }
                _alphaColorMapData.ColorMapPixelData = new byte[uncompressedSize - offset];
                for (int i = 0; i < uncompressedSize - offset; i++, offset++)
                    _alphaColorMapData.ColorMapPixelData[i] = uncompressed[offset];
            }
            else if (_bitmapFormat == 4 || _bitmapFormat == 5)
            {
                int uncompressedSize = imageSize * 4;
                byte[] uncompressed = new byte[uncompressedSize];
                byte[] compressed = binaryReader.ReadBytes(toReaded);
                Inflater zipInflator = 	new Inflater();
                zipInflator.SetInput(compressed);
                zipInflator.Inflate(uncompressed, 0, uncompressedSize);

                _alphaBitmapData = new AlphaBitmapData();
                _alphaBitmapData.BitmapPixelData = new RGBA[imageSize];
                for (int i = 0, j = 0; i < imageSize; i++, j += 4)
                {
                    byte red = uncompressed[j];
                    byte green = uncompressed[j + 1];
                    byte blue = uncompressed[j + 2];
                    byte alpha = uncompressed[j + 3];
                    _alphaBitmapData.BitmapPixelData[i] = new RGBA(red, green, blue, alpha);
                }
            }
        }
Exemplo n.º 47
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 5)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            if (exportedCharacters != null)
                w.Write((ushort)exportedCharacters.Count);
            else
                w.Write((ushort)0);

            if (exportedCharacters != null)
            {
                IEnumerator assertEnu = exportedCharacters.GetEnumerator();
                while (assertEnu.MoveNext())
                {
                    Assert assert = (Assert)assertEnu.Current;
                    assert.WriteTo(w);
                }
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 48
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            characterId = binaryReader.ReadUInt16();
            numFrames = binaryReader.ReadUInt16();
            width = binaryReader.ReadUInt16();
            height = binaryReader.ReadUInt16();
            binaryReader.ReadUBits(5);
            videoFlagsDeblocking = binaryReader.ReadUBits(2);
            videoFlagsSmoothing = binaryReader.ReadBoolean();
            codecId = binaryReader.ReadByte();
        }
Exemplo n.º 49
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 3)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);
            w.Write(this.buttonId);
            w.WriteUBits(0, 7);
            w.WriteBoolean(trackAsMenu);
            w.Write(this.actionOffset);
            if (characters != null)
            {
                IEnumerator butts = characters.GetEnumerator();
                while (butts.MoveNext())
                {
                    ((ButtonRecord)butts.Current).WriteTo(w, TagCodeEnum.DefineButton2);
                    w.SynchBits();
                }
            }
            w.Write((byte)0);
            if (actions != null)
            {
                for (int i = 0; i < actions.Count; i++)
                {
                    ButtonCondaction buttCon = actions[i];
                    if (i == actions.Count - 1)
                        w.Write((ushort)0);
                    else
                    {
                        int size = buttCon.GetSizeOf();
                        w.Write((ushort)size);
                    }
                    buttCon.WriteTo(w);
                }
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 50
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 6)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            w.Write(this.characterId);
            w.Write(this.numFrames);
            w.Write(this.width);
            w.Write(this.height);

            w.WriteUBits(0, 5);
            w.WriteUBits(videoFlagsDeblocking, 2);
            w.WriteBoolean(videoFlagsSmoothing);

            w.Write(this.codecId);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 51
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            int beforePos = (int)binaryReader.BaseStream.Position;
            int toReaded = (int)rh.TagLength - 7;

            _characterId = binaryReader.ReadUInt16();
            _bitmapFormat = binaryReader.ReadByte();
            _bitmapWidth = binaryReader.ReadUInt16();
            _bitmapHeight = binaryReader.ReadUInt16();
            _bitmapColorTableSize = 0;

            if (_bitmapFormat == 3)
            {
                _bitmapColorTableSize = binaryReader.ReadByte();
                toReaded--;
            }

            if (_bitmapFormat == 3)
            {
                _colorMapData = new ColorMapData();
                _colorMapData.ReadData(binaryReader, _bitmapColorTableSize, _bitmapWidth, _bitmapHeight, toReaded);
            }
            else if (_bitmapFormat == 4 || _bitmapFormat == 5)
            {
                int imageSize = _bitmapWidth * _bitmapHeight;
                int uncompressedSize = imageSize;
                if (_bitmapFormat == 4)
                    uncompressedSize *= 2;
                else
                    uncompressedSize *= 4;

                byte[] uncompressed = new byte[uncompressedSize];
                byte[] compressed = binaryReader.ReadBytes(toReaded);
                Inflater zipInflator = 	new Inflater();
                zipInflator.SetInput(compressed);
                zipInflator.Inflate(uncompressed, 0, uncompressedSize);

                _bitmapColorData = null;
                if (_bitmapFormat == 4)
                {
                    Pix15[] bitmapPixelData = new Pix15[imageSize];
                    for (int i = 0, j = 0; i < imageSize; i++, j += 2)
                    {
                        byte[] data = new byte[2] {uncompressed[j], uncompressed[j+1]};
                        bitmapPixelData[i] = new Pix15(data);
                    }
                    _bitmapColorData = new BitmapColorData(bitmapPixelData);
                }
                else
                {
                    Pix24[] bitmapPixelData = new Pix24[imageSize];
                    for (int i = 0, j = 0; i < imageSize; i++, j += 4)
                    {
                        byte reserved = uncompressed[j];
                        byte red = uncompressed[j + 1];
                        byte green = uncompressed[j + 2];
                        byte blue = uncompressed[j + 3];
                        bitmapPixelData[i] = new Pix24(red, green, blue);
                    }
                    _bitmapColorData = new BitmapColorData(bitmapPixelData);
                }
            }
        }
Exemplo n.º 52
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            uint max = rh.TagLength;
            if (version >= 6)
                max--;
            name = binaryReader.ReadString(max);
            if (version >= 6)
               binaryReader.ReadByte();
        }
Exemplo n.º 53
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            characterId = binaryReader.ReadUInt16();
            binaryReader.SynchBits();

            startBounds = new Rect();
            startBounds.ReadData(binaryReader);

            binaryReader.SynchBits();
            endBounds = new Rect();
            endBounds.ReadData(binaryReader);
            binaryReader.SynchBits();

            offset = binaryReader.ReadUInt32();

            morphFillStyles = new MorphFillStyleCollection();
            morphFillStyles.ReadData(binaryReader);

            morphLineStyles = new MorphLineStyleCollection();
            morphLineStyles.ReadData(binaryReader);

            ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count;
            ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count;

            startEdges = new ShapeRecordCollection();
            startEdges.ReadData(binaryReader, ShapeType.None);

            ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count;
            ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count;

            endEdges = new ShapeRecordCollection();
            endEdges.ReadData(binaryReader, ShapeType.None);
        }
Exemplo n.º 54
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 6)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf(), true);

            rh.WriteTo(w);
            w.Write(this.fontId);
            w.Write((byte)this.fontName.Length);
            if (fontName != null)
                w.WriteString(this.fontName, (uint)this.fontName.Length);

            w.WriteUBits(0, 2);
            w.WriteBoolean(fontFlagsSmallText);
            w.WriteUBits(0, 2);
            w.WriteBoolean(fontFlagsItalic);
            w.WriteBoolean(fontFlagsBold);
            w.WriteBoolean(true);

            w.Write(this.languageCode);
            if (codeTable != null)
            {
                IEnumerator glyphs = codeTable.GetEnumerator();
                while (glyphs.MoveNext())
                    w.Write((ushort)glyphs.Current);
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 55
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            soundId = binaryReader.ReadUInt16();

            soundFormat = binaryReader.ReadUBits(4);
            soundRate = binaryReader.ReadUBits(2);
            soundSize = binaryReader.ReadUBits(1);
            soundType = binaryReader.ReadUBits(1);

            soundSampleCount = binaryReader.ReadUInt32();

            uint size = rh.TagLength - 2 - 1 - 4;
            soundData = new byte[size];
            for (uint i = 0; i < size; i++)
                soundData[i] = binaryReader.ReadByte();
        }
Exemplo n.º 56
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            recursion = binaryReader.ReadUInt16();
            timeout = binaryReader.ReadUInt16();
        }
Exemplo n.º 57
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            fontId = binaryReader.ReadUInt16();
            byte fontNameLen = binaryReader.ReadByte();
            fontName = binaryReader.ReadString(fontNameLen);

            binaryReader.ReadUBits(2); //reserved
            fontFlagsSmallText = binaryReader.ReadBoolean();
            binaryReader.ReadUBits(2); //not used
            fontFlagsItalic = binaryReader.ReadBoolean();
            fontFlagsBold = binaryReader.ReadBoolean();
            binaryReader.ReadBoolean(); //not used

            languageCode = binaryReader.ReadByte();

            long codeTableLenght = rh.TagLength - 5 - fontNameLen;
            codeTable = null;
            codeTable = new ushort[codeTableLenght];
            for (int i = 0; i < codeTableLenght / 2; i++)
                codeTable[i] = binaryReader.ReadUInt16();
        }
Exemplo n.º 58
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 7)
                return;

            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, 4);

            rh.WriteTo(w);
            w.Write(recursion);
            w.Write(timeout);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }
Exemplo n.º 59
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            binaryReader.ReadUBits(4);
            playbackSoundRate = binaryReader.ReadUBits(2);
            playbackSoundSize = binaryReader.ReadUBits(1);
            playbackSoundType = binaryReader.ReadUBits(1);
            streamSoundCompression = binaryReader.ReadUBits(4);
            streamSoundRate = binaryReader.ReadUBits(2);
            streamSoundSize = binaryReader.ReadUBits(1);
            streamSoundType = binaryReader.ReadUBits(1);

            streamSoundSampleCount = binaryReader.ReadUInt16();
            latencySeek = 0;

            if (streamSoundCompression == 2)
                latencySeek = binaryReader.ReadInt16();
        }
Exemplo n.º 60
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            MemoryStream m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());
            rh.WriteTo(w);

            w.WriteUBits(0, 4);
            w.WriteUBits(playbackSoundRate, 2);
            w.WriteUBits(playbackSoundSize, 1);
            w.WriteUBits(playbackSoundType, 1);
            w.WriteUBits(streamSoundCompression, 4);
            w.WriteUBits(streamSoundRate, 2);
            w.WriteUBits(streamSoundSize, 1);
            w.WriteUBits(streamSoundType, 1);
            w.Write(streamSoundSampleCount);
            if (streamSoundCompression == 2)
                w.Write(latencySeek);

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }