Recurity.Swf.FillStyleArray.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._fillStyleCount = br.ReadByte();

            if (this._fillStyleCount.Equals(0xFF))
            {
                if (caller.Equals(TagTypes.DefineShape2) || caller.Equals(TagTypes.DefineShape3))
                {
                    this._fillStyleCountExtended = br.ReadUInt16();

                    //Log.InfoFormat("{0}(0x{0:x4}) fillstyles will be parsed", (int)this._fillStyleCountExtended);

                    for (UInt16 i = 0; i < this._fillStyleCountExtended; i++)
                    {
                        FillStyle temp = new FillStyle(this._SwfVersion);
                        try
                        {
                            temp.Parse(input, caller);
                            this._fillStyles.Add(temp);
                        }
                        catch (SwfFormatException e)
                        {
                           Log.Error(this, e.Message);
                        }
                    }
                }
                else
                {
                    SwfFormatException e = new SwfFormatException("Extended count of fill styles supported only for Shape2 and Shape3.");
                   Log.Error(this, e.Message);
                    throw e;
                }
            }
            else
            {
                //Log.InfoFormat("{0}(0x{0:x4}) fillstyles will be parsed", (int)this._fillStyleCount);

                for (byte i = 0; i < this._fillStyleCount; i++)
                {
                    FillStyle temp = new FillStyle(this._SwfVersion);
                    try
                    {
                        temp.Parse(input, caller);
                    }
                    catch (SwfFormatException e)
                    {
                        throw e;
                    }

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