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

Parse() public method

public Parse ( Stream input, TagTypes caller ) : void
input Stream
caller TagTypes
return void
        public virtual void Parse(Stream input, TagTypes caller)
        {
            BinaryReader br = new BinaryReader(input);

            this._width = br.ReadUInt16();

            if (caller.Equals(TagTypes.DefineShape) || caller.Equals(TagTypes.DefineShape2))
            {
                this._color = new Rgb(this._SwfVersion);

                try
                {
                    this._color.Parse(input);
                }
                catch(SwfFormatException e)
                {
                    throw e;
                }

            }
            else if (caller.Equals(TagTypes.DefineShape3))
            {
                this._color = new Rgba(this._SwfVersion);

                try
                {
                    this._color.Parse(input);
                }
                catch (SwfFormatException e)
                {
                    throw e;
                }

            }
            else
            {
                SwfFormatException e = new SwfFormatException("LineStyle was called by illegal TagType (" + caller.ToString() +").");
               Log.Error(this, e.Message);
            }
        }

Usage Example

Exemplo n.º 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);
                    }
                }
            }
        }