Recurity.Swf.LineStyle2.Parse C# (CSharp) 메소드

Parse() 공개 메소드

public Parse ( Stream input, TagTypes caller ) : void
input Stream
caller TagTypes
리턴 void
        public override void Parse(Stream input, TagTypes caller)
        {
            BinaryReader br = new BinaryReader(input);

            this._width = br.ReadUInt16();

            BitStream bits = new BitStream(input);

            this._startCapStyle = (CapStyle)(Convert.ToByte(bits.GetBits(2)));
            this._joinstyle = (JoinStyle)(Convert.ToByte(bits.GetBits(2)));

            this._hasFillFlag = (0 != bits.GetBits(1) ? true : false);
            this._noHScale = (0 != bits.GetBits(1) ? true : false);
            this._noVScale = (0 != bits.GetBits(1) ? true : false);
            this._pixelHinting = (0 != bits.GetBits(1) ? true : false);

            bits.GetBits(5); // reserved must be null

            this._noClose = (0 != bits.GetBits(1) ? true : false);

            this._endCapStyle = (CapStyle)bits.GetBits(2);

            if (this._joinstyle.Equals(JoinStyle.Miter))
            {
                bits.Reset();
                this._miterLimtiFactor = br.ReadUInt16();
            }
            if (!this._hasFillFlag)
            {
                bits.Reset();
                this._color.Parse(input);
            }
            if (this._hasFillFlag)
            {
                bits.Reset();
                this._fillStyle.Parse(input, caller);
            }
        }

Usage Example

예제 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public virtual void Parse(Stream input, TagTypes caller)
        {
            BinaryReader br = new BinaryReader(input);

            this._lineStyleCount = br.ReadByte();

            if (caller.Equals(TagTypes.DefineShape4))
            {
                if (this._lineStyleCount.Equals(0xFF))
                {
                    this._lineStyleCountExtended = br.ReadUInt16();
                    LineStyle2 temp = null;

                    for (byte i = 0; i < this._lineStyleCountExtended; i++)
                    {
                        temp = new LineStyle2(this._SwfVersion);
                        try
                        {
                            temp.Parse(input, caller);
                        }
                        catch (SwfFormatException e)
                        {
                            throw e;
                        }
                        this._lineStyles.Add(temp);
                    }
                }
                else
                {
                    LineStyle2 temp = null;

                    for (byte i = 0; i < this._lineStyleCount; i++)
                    {
                        temp = new LineStyle2(this._SwfVersion);

                        try
                        {
                            temp.Parse(input, caller);
                        }
                        catch (SwfFormatException e)
                        {
                            throw e;
                        }

                        this._lineStyles.Add(temp);
                    }
                }
            }
            else
            {
                if (this._lineStyleCount.Equals(0xFF))
                {
                    this._lineStyleCountExtended = br.ReadUInt16();
                    LineStyle temp = null;

                    for (byte i = 0; i < this._lineStyleCountExtended; i++)
                    {
                        temp = new LineStyle(this._SwfVersion);

                        try
                        {
                            temp.Parse(input, caller);
                        }
                        catch (SwfFormatException e)
                        {
                            throw e;
                        }

                        this._lineStyles.Add(temp);
                    }
                }
                else
                {

                    for (byte i = 0; i < this._lineStyleCount; i++)
                    {
                        LineStyle temp = new LineStyle(this._SwfVersion);

                        try
                        {
                            temp.Parse(input, caller);
                        }
                        catch (SwfFormatException e)
                        {
                            throw e;
                        }

                        this._lineStyles.Add(temp);
                    }
                }
            }
        }