SynchBits() public method

Synchronizes the bits.
public SynchBits ( ) : void
return void
コード例 #1
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);
        }
コード例 #2
0
ファイル: Matrix.cs プロジェクト: foresightbrand/brandqq
 /// <summary>
 /// Reads the data.
 /// </summary>
 /// <param name="binaryReader">Binary reader.</param>
 public void ReadData(BufferedBinaryReader binaryReader)
 {
     base.SetStartPoint(binaryReader);
     binaryReader.SynchBits();
     bool hasScale = binaryReader.ReadBoolean();
     if (hasScale)
     {
         uint nScaleBits = binaryReader.ReadUBits(5);
         matrix[0, 0] = binaryReader.ReadFloat(nScaleBits);
         matrix[1, 1] = binaryReader.ReadFloat(nScaleBits);
     }
     bool hasRotate = binaryReader.ReadBoolean();
     if (hasRotate)
     {
         uint nRotateBits = binaryReader.ReadUBits(5);
         matrix[1, 0] = binaryReader.ReadFloat(nRotateBits);
         matrix[0, 1] = binaryReader.ReadFloat(nRotateBits);
     }
     uint nTranslateBits = binaryReader.ReadUBits(5);
     matrix[0, 2] = (float)binaryReader.ReadSBits(nTranslateBits);
     matrix[1, 2] = (float)binaryReader.ReadSBits(nTranslateBits);
     binaryReader.SynchBits();
     base.SetEndPoint(binaryReader);
 }
コード例 #3
0
ファイル: Rect.cs プロジェクト: Berenold/SwfExport
 /// <summary>
 /// Reads the data.
 /// </summary>
 /// <param name="binaryReader">Binary reader.</param>
 /// <param name="numGlyphs">Num glyphs.</param>
 public void ReadData(BufferedBinaryReader binaryReader, ushort numGlyphs)
 {
     Clear();
     for (int i = 0; i < numGlyphs; i++)
     {
         binaryReader.SynchBits();
         Rect fontBound = new Rect();
         fontBound.ReadData(binaryReader);
         Add(fontBound);
     }
 }
コード例 #4
0
ファイル: SwfHeader.cs プロジェクト: foresightbrand/brandqq
        /// <summary>
        /// Reads the data from a binary file
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        public void ReadData(BufferedBinaryReader binaryReader)
        {
            this.signature = binaryReader.ReadString(3);
            this.version = binaryReader.ReadByte();

            if (this.version > MAX_VERSION)
                throw new InvalidSwfVersionException(this.version, MAX_VERSION);

            this.fileSize = binaryReader.ReadUInt32();
            this.rect = new Rect();
            this.rect.ReadData(binaryReader);
            binaryReader.SynchBits();
            this.fps = binaryReader.ReadFloatWord(8, 8);
            this.frames = binaryReader.ReadUInt16();
        }
コード例 #5
0
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="shapeType">Shape type.</param>
        public void ReadData(BufferedBinaryReader binaryReader, ShapeType shapeType)
        {
            binaryReader.SynchBits();
            byte numFillBits = (byte)binaryReader.ReadUBits(4);
            byte numLineBits = (byte)binaryReader.ReadUBits(4);

            bool readEndShapeRecord = false;
            while (!readEndShapeRecord)
            {
                bool type = binaryReader.ReadBoolean();
                byte flags = (byte)binaryReader.ReadUBits(5);

                if (type == false)
                {
                    //Non-edge record
                    if (flags == 0)
                    {
                        //EndShapeRecord
                        readEndShapeRecord = true;
                        this.Add(new EndShapeRecord());
                        if (log.IsInfoEnabled)
                            log.Info("Shape: EndShapeRecord");
                    }
                    else
                    {
                        //StyleChangerecord
                        StyleChangeRecord styleChange = new StyleChangeRecord();
                        styleChange.ReadData(binaryReader, flags, ref numFillBits, ref numLineBits, shapeType);
                        this.Add(styleChange);
                        if (log.IsInfoEnabled)
                            log.Info("Shape: StyleChangeRecord");
                    }
                }
                else
                {
                    //Edge record
                    if ((flags & 0x10) != 0)
                    {
                        //StraightedEdgeRecord
                        StraightEdgeRecord straight = new StraightEdgeRecord();
                        straight.ReadData(binaryReader, flags);
                        this.Add(straight);
                        if (log.IsInfoEnabled)
                            log.Info("Shape: StraightedEdgeRecord");
                    }
                    else
                    {
                        //CurvedEdgeRecord
                        CurvedEdgeRecord curved = new CurvedEdgeRecord();
                        curved.ReadData(binaryReader, flags);
                        this.Add(curved);
                        if (log.IsInfoEnabled)
                            log.Info("Shape: CurvedEdgeRecord");
                    }
                }
            }
        }
コード例 #6
0
ファイル: TextRecord.cs プロジェクト: Berenold/SwfExport
        /// <summary>
        /// Reads the data.
        /// </summary>
        /// <param name="binaryReader">Binary reader.</param>
        /// <param name="endOfRecordsFlag">End of records flag.</param>
        /// <param name="tagCodeEnum">Tag code enum.</param>
        public void ReadData(BufferedBinaryReader binaryReader, ref bool endOfRecordsFlag, 
            TagCodeEnum tagCodeEnum)
        {
            binaryReader.SynchBits();
            bool textRecordType = binaryReader.ReadBoolean();
            binaryReader.ReadUBits(3);

            bool styleFlagsHasFont = binaryReader.ReadBoolean();
            bool styleFlagsHasColor = binaryReader.ReadBoolean();
            bool styleFlagsHasYOffset = binaryReader.ReadBoolean();
            bool styleFlagsHasXOffset = binaryReader.ReadBoolean();

            if (textRecordType == false)
            {
                endOfRecordsFlag = true;
                return;
            }

            fontId = 0;
            if (styleFlagsHasFont)
                fontId = binaryReader.ReadUInt16();

            textColor = null;
            if (styleFlagsHasColor)
            {
                if (tagCodeEnum == TagCodeEnum.DefineText2)
                {
                    textColor = new RGBA();
                    textColor.ReadData(binaryReader);
                }
                else
                {
                    textColor = new RGB();
                    textColor.ReadData(binaryReader);
                }
            }

            xOffset = 0;
            if (styleFlagsHasXOffset)
                xOffset = binaryReader.ReadInt16();

            yOffset = 0;
            if (styleFlagsHasYOffset)
                yOffset = binaryReader.ReadInt16();

            textHeight = 0;
            if (styleFlagsHasFont)
                textHeight = binaryReader.ReadUInt16();

            byte glyphCount = binaryReader.ReadByte();
            if (glyphCount > 0)
            {
                if (glyphEntries == null)
                    glyphEntries = new GlyphEntryCollection();
                else
                    glyphEntries.Clear();

                for (int i = 0; i < glyphCount; i++)
                {
                    GlyphEntry glyphEntry = new GlyphEntry();
                    glyphEntry.ReadData(binaryReader);
                    glyphEntries.Add(glyphEntry);
                }
            }
        }