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

Parse() public method

Parses this object out of a stream
public Parse ( Stream input ) : void
input Stream The input stream.
return void
        public virtual void Parse(Stream input)
        {
            BinaryReader br = new BinaryReader(input);

            this._startWidth = br.ReadUInt16();
            this._endWidth = br.ReadUInt16();
            this._startColor.Parse(input);
            this._endColor.Parse(input);
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public override void Parse(Stream input, TagTypes caller)
        {
            BinaryReader br = new BinaryReader(input);

            this._lineStyleCount = br.ReadByte();

            if (caller.Equals(TagTypes.DefineMorphShape2))
            {
                if (this._lineStyleCount.Equals(0xFF))
                {
                    this._lineStyleCountExtended = br.ReadUInt16();

                    for (UInt16 i = 0; i < this._lineStyleCountExtended; i++)
                    {
                        MorphLineStyle2 temp = new MorphLineStyle2(this._SwfVersion);
                        temp.Parse(input);
                        this._lineStyles.Add(temp);
                    }
                }
                else
                {

                    for (byte i = 0; i < this._lineStyleCount; i++)
                    {
                        MorphLineStyle2 temp = new MorphLineStyle2(this._SwfVersion);
                        temp.Parse(input);
                        this._lineStyles.Add(temp);
                    }

                }
            }
            else if (caller.Equals(TagTypes.DefineMorphShape))
            {
                if (this._lineStyleCount.Equals(0xFF))
                {
                    this._lineStyleCountExtended = br.ReadUInt16();

                    for (UInt16 i = 0; i < this._lineStyleCountExtended; i++)
                    {
                        MorphLineStyle temp = new MorphLineStyle(this._SwfVersion);
                        temp.Parse(input);
                        this._lineStyles.Add(temp);
                    }
                }
                else
                {
                    MorphLineStyle temp = null;

                    for (byte i = 0; i < this._lineStyleCount; i++)
                    {
                        temp = new MorphLineStyle(this._SwfVersion);
                        temp.Parse(input);
                        this._lineStyles.Add(temp);
                    }
                }
            }
            else
            {
                Exception e = new Exception(" Only DefineMorphShape2 and DefineMorphShape can access MorphLineStyleArray ");
               Log.Error(this, e.Message);
                throw e;
            }
        }