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

Parse() public method

public Parse ( Stream input ) : void
input Stream
return void
        public void Parse( Stream input )
        {
            BitStream bits = new BitStream( input );

            _HasAddTerms = ( 1 == bits.GetBits( 1 ) );
            _HasMultTerms = ( 1 == bits.GetBits( 1 ) );
            _numBits = (byte)bits.GetBits( 4 );

            if ( _HasMultTerms )
            {
                _RedMultTerm = bits.GetBitsSigned( _numBits );
                _GreenMultTerm = bits.GetBitsSigned( _numBits );
                _BlueMultTerm = bits.GetBitsSigned( _numBits );
                _AlphaMultTerm = bits.GetBitsSigned( _numBits );
            }

            if ( _HasAddTerms )
            {
                _RedAddTerm = bits.GetBitsSigned( _numBits );
                _GreenAddTerm = bits.GetBitsSigned( _numBits );
                _BlueAddTerm = bits.GetBitsSigned( _numBits );
                _AlphaAddTerm = bits.GetBitsSigned( _numBits );
            }

            if ( ( !_HasAddTerms ) && ( !_HasMultTerms ) )
            {
                //
                // When none of the two flags are set, get the remaining bits
                // so that the entire method here works byte aligned
                //
                bits.GetBitsSigned( 2 );
            }
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public override void Parse( Stream input )
        {
            base.Parse( input );

            _ColorTransform = new CxFormWithAlpha( this.Version );
            _ColorTransform.Parse( input );
               //Log.Debug(this,  _ColorTransform.ToString() );

            if ( _ButtonHasFilterList )
            {
                _FilterList = new FilterList( this.Version );
                _FilterList.Parse( input );
            }

            if ( _ButtonHasBlendMode )
            {
                BinaryReader br = new BinaryReader( input );
                _BlendMode = br.ReadByte();

                if ( _BlendMode > 14 )
                {
                    throw new SwfFormatException( "ButtonRecord2 BlendMode > 14" );
                }
            }

               //Log.Debug(this,  this.ToString() );
        }