Inheritance: System.IO.BinaryReader
Exemple #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public void Parse( Stream input )
        {
            BinaryReader2 br = new BinaryReader2( input );

            _numFilters = br.ReadByte();
            _Filters = new List<AbstractFilter>( _numFilters );

            for ( int i = 0; i < _numFilters; i++ )
            {
                AbstractFilter.FilterTypes nextFilterType = ( AbstractFilter.FilterTypes )br.ReadByte();
                AbstractFilter aFilter;

                switch ( nextFilterType )
                {
                    case AbstractFilter.FilterTypes.DropShadowFilter:
                        aFilter = new Filter.DropShadowFilter( this.Version );
                        break;

                    case AbstractFilter.FilterTypes.BevelFilter:
                        aFilter = new Filter.BevelFilter( this.Version );
                        break;

                    case AbstractFilter.FilterTypes.BlurFilter:
                        aFilter = new Filter.BlurFilter( this.Version );
                        break;

                    case AbstractFilter.FilterTypes.ColorMatrixFilter:
                        aFilter = new Filter.ColorMatrixFilter( this.Version );
                        break;

                    case AbstractFilter.FilterTypes.ConvolutionFilter:
                        aFilter = new Filter.ConvolutionFilter( this.Version );
                        break;

                    case AbstractFilter.FilterTypes.GlowFilter:
                        aFilter = new Filter.GlowFilter( this.Version );
                        break;

                    case AbstractFilter.FilterTypes.GradientBevelFilter:
                        aFilter = new Filter.GradientBevelFilter( this.Version );
                        break;

                    case AbstractFilter.FilterTypes.GradientGlowFilter:
                        aFilter = new Filter.GradientGlowFilter( this.Version );
                        break;

                    default:
                        SwfFormatException e = new SwfFormatException( "Illegal Filter Type ID " + nextFilterType.ToString( "d" ) );
                       Log.Error(this,  e );
                        throw e;
                }

                aFilter.Parse( input );
                _Filters.Add( aFilter );
            }
        }
Exemple #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public bool Parse( Stream input )
        {
            BinaryReader2 br = new BinaryReader2( input );
            bool parsingSuccess = true;

            UInt16 uselessButFiddelingWithBitsThanksAdobe = br.ReadUInt16();
            if ( 0 != uselessButFiddelingWithBitsThanksAdobe )
            {
                SwfFormatException sfe = new SwfFormatException( "Reserved 16Bit Field in CLIPACTION used" );
               Log.Error(this,  sfe );
                throw sfe;
            }

            _ClipEventFlags = new ClipEventFlags( this.Version );
            _ClipEventFlags.Parse( input );

            _ClipActionRecords = new List<ClipActionRecord>();
            //
            // The ClipActionEndFlag is Version dependent!
            //
            while ( 0 != ( this.Version <= 5 ? br.PeekUInt16() : br.PeekUInt32() ) )
            {
                ClipActionRecord record = new ClipActionRecord( this.Version );
                bool recordParsingResult = record.Parse( input );
                _ClipActionRecords.Add( record );
                parsingSuccess = recordParsingResult & parsingSuccess;
            }
            //
            // Get the EndRecord (Version dependent) and ignore
            //
            UInt32 endRecord = this.Version <= 5 ? br.ReadUInt16() : br.ReadUInt32();

            if ( 0 != endRecord )
            {
                SwfFormatException sfe = new SwfFormatException( "endRecord is not 0x00/0x0000" );
               Log.Error(this,  sfe );
                throw sfe;
            }

               //Log.Debug(this,  _ClipActionRecords.Count + " ClipActionRecords added" );

            return parsingSuccess;
        }