Recurity.Swf.CurvedEdgeRecord.Parse C# (CSharp) Method

Parse() public method

public Parse ( Stream output, BitStream bits ) : void
output Stream
bits BitStream
return void
        public override void Parse(Stream output, BitStream bits)
        {
            this._numbits = (byte)bits.GetBits(4);

            this._controlDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._controlDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._anchorDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._anchorDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public virtual void TryParseShapeRecords(MemoryStream input, TagTypes caller)
        {
            BitStream bits = new BitStream(input);

            this._shapeRecords = new List<ShapeRecord>();

            StyleChangeRecord tempSCR = new StyleChangeRecord(this._SwfVersion);
            StraightEdgeRecord tempSER = new StraightEdgeRecord(this._SwfVersion);
            CurvedEdgeRecord tempCER = new CurvedEdgeRecord(this._SwfVersion);

            byte fiveBits = 0;
            bool endShapeRecordSeen = false;
            int numberOfStyleChanges = 0;

            UInt16 localNumFillBits = this._numFillBits;
            UInt16 localNumLineBits = this._numLineBits;

            do
            {
                bool typeFlag = (0 != bits.GetBits(1)) ? true : false;

                if (typeFlag)
                {
                    bool straightFlag = Convert.ToBoolean(bits.GetBits(1));

                    if (straightFlag)
                    {
                        tempSER = new StraightEdgeRecord(this._SwfVersion);
                        tempSER.Parse(input, bits);
                        this._shapeRecords.Add(tempSER);
                    }
                    else
                    {
                        tempCER = new CurvedEdgeRecord(this._SwfVersion);
                        tempCER.Parse(input, bits);
                        this._shapeRecords.Add(tempCER);
                    }
                }
                else
                {
                    fiveBits = (byte)bits.GetBits(5);

                    if (0 == fiveBits)
                    {
                        endShapeRecordSeen = true;
                    }
                    else
                    {
                        tempSCR = new StyleChangeRecord(this._SwfVersion);
                        tempSCR.Parse(input, bits, fiveBits, caller, ref localNumFillBits, ref localNumLineBits, 0 == numberOfStyleChanges ? true : false);
                        numberOfStyleChanges += 1;
                        this._shapeRecords.Add(tempSCR);
                    }
                }
            }
            while (!endShapeRecordSeen);
            bits.Reset();
        }