GetBits() public method

public GetBits ( UInt32 numerOfBits ) : UInt32
numerOfBits System.UInt32
return System.UInt32
Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="inout"></param>
        /// <param name="bits"></param>
        public override void Parse(Stream inout, BitStream bits)
        {
            this._numbits = (UInt32)bits.GetBits(4);

            this._generalLineFlag = (0 != bits.GetBits(1)) ? true : false;

            if (this._generalLineFlag)
            {
                this._deltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
                this._deltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            }
            else
            {
                this._vertLineFlag = (0 != bits.GetBits(1)) ? true : false;

                if (this._vertLineFlag)
                {
                    this._deltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
                }
                else
                {
                    this._deltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        /// <param name="input">The input stream.</param>
        public override void Parse( Stream input )
        {
            BitStream bits = new BitStream(input);

            bits.GetBits( 1 ); // reserved
            this._Red   = (Byte)bits.GetBits( 5 );
            this._Green = (Byte)bits.GetBits( 5 );
            this._Blue  = (Byte)bits.GetBits( 5 );
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public override void Parse(Stream input)
        {
            BinaryReader br = new BinaryReader(input);
            BitStream bits = new BitStream(input);

            this._initialSampleLeft = br.ReadInt16();
            this._initialIndexLeft = (Byte)bits.GetBits(6);
            this._initialSampleRight = br.ReadInt16();
            this._initialIndexRight = (Byte)bits.GetBits(6);

            this._adpcmCodeData = new Byte[(Int32)(input.Length - input.Position) + 2];
            input.Read(this._adpcmCodeData, 0, this._adpcmCodeData.Length);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public void Parse(Stream input)
        {
            BitStream bits = new BitStream(input);

            if (_HasScale = (1 == bits.GetBits(1)))
            {
                _numScaleBits = (byte)bits.GetBits(5);
                bits.GetBitsFB(_numScaleBits, out _xScaleF);
                bits.GetBitsFB(_numScaleBits, out _yScaleF);
            }

            _numTranslateBits = (byte)bits.GetBits(5);
            _translateX = bits.GetBitsSigned(_numTranslateBits);
            _translateY = bits.GetBitsSigned(_numTranslateBits);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        public void Parse(BitStream bits, byte glyphBits, byte advancedBits)
        {
            this._glyphBits = glyphBits;
            this._advancedBits = advancedBits;

            this._glyphIndex =   bits.GetBits((UInt32)glyphBits);
            this._glyphAdvance = bits.GetBitsSigned((UInt32)advancedBits);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        public void Parse(Stream input)
        {
            BinaryReader br = new BinaryReader(input);

            this._numZoneData = br.ReadByte();

            ZoneData temp = null;

            for (int i = 0; i < this._numZoneData; i++)
            {
                temp = new ZoneData(this._SwfVersion);
                temp.Parse(input);
                this._zoneData.Add(temp);
            }

            BitStream bits = new BitStream(input);
            bits.GetBits(6); //reserved
            this._zoneMaskY = ((0 != bits.GetBits(1)) ? true : false);
            this._zoneMaskX = ((0 != bits.GetBits(1)) ? true : false);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public override void Parse( Stream input, TagTypes caller )
        {
            BitStream bits = new BitStream( input );

            this._spreadMode = ( SpreadMode )bits.GetBits( 2 );
            this._interpolationMode = ( InterPolation )bits.GetBits( 2 );
            this._numGradients = ( byte )bits.GetBits( 4 );

            bits.Reset();

            GradRecord temp = new GradRecord(this._SwfVersion);

            for ( int i = 0; i < _numGradients; i++ )
            {
                temp = new GradRecord( this._SwfVersion );
                temp.Parse( input, caller );
                this._gradientRecords.Add(temp);
            }

            bits.GetBitsFB( 16, out this._focalPoint );
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        /// <param name="input">The input stream.</param>
        internal void Parse(Stream input)
        {
            BinaryReader br = new BinaryReader(input);

            BitStream bs = new BitStream(input);

            this._HasAddTerms = 0 != bs.GetBits(1) ? true : false;
            this._HasMultTerms = 0 != bs.GetBits(1) ? true : false;

            this._Nbits = (Byte)bs.GetBits(4);

            this._RedMultTerm = (Byte)bs.GetBits(this._Nbits);
            this._GreenMultTerm = (Byte)bs.GetBits(this._Nbits);
            this._BlueMultTerm = (Byte)bs.GetBits(this._Nbits);

            this._RedAddTerm = (Byte)bs.GetBits(this._Nbits);
            this._GreenAddTerm = (Byte)bs.GetBits(this._Nbits);
            this._BlueAddTerm = (Byte)bs.GetBits(this._Nbits);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="type"></param>
        public void Parse(Stream input, SoundType type)
        {
            BitStream bits = new BitStream(input);

            this._ADPCMCodeSize = (Byte)bits.GetBits(2);

            if (type.Equals(SoundType.mono))
            {
                AdpcmMonoPacket packet = new AdpcmMonoPacket();
                packet.Parse(input);
                this._ADPCMPacket = packet;
            }
            else if (type.Equals(SoundType.stereo))
            {
                AdpcmStereoPacket packet = new AdpcmStereoPacket();
                packet.Parse(input);
                this._ADPCMPacket = packet;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        /// <param name="input">The input stream.</param>
        public override void Parse(Stream input)
        {
            BinaryReader br = new BinaryReader(input);

            this._startWidth = br.ReadUInt16();
            this._endWidth = br.ReadUInt16();

            BitStream bits = new BitStream(input);

            this._startCapStyle = (CapStyle)(Convert.ToByte(bits.GetBits(2)));
            this._joinstyle = (JoinStyle)(Convert.ToByte(bits.GetBits(2)));

            this._hasFillFlag = (0 != bits.GetBits(1) ? true : false);
            this._noHScale = (0 != bits.GetBits(1) ? true : false);
            this._noVScale = (0 != bits.GetBits(1) ? true : false);
            this._pixelHinting = (0 != bits.GetBits(1) ? true : false);

            bits.GetBits(5); // reserved must be null

            this._noClose = (0 != bits.GetBits(1) ? true : false);

            this._endCapStyle = (CapStyle)bits.GetBits(2);

            if (this._joinstyle.Equals(JoinStyle.Miter))
            {
                this._miterLimtiFactor = br.ReadUInt16();
            }
            if (!this._hasFillFlag)
            {
                this._startColor.Parse(input);
                this._endColor.Parse(input);
            }
            if (this._hasFillFlag)
            {
                //bits.Reset();
                this._fillStyle.Parse(input);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public virtual void Parse( Stream input )
        {
            BitStream bits = new BitStream( input );

            uint reserved = bits.GetBits( 2 );
            if ( 0 != reserved )
            {
                throw new SwfFormatException( "ButtonRecord reserved bits used" );
            }

            _ButtonHasBlendMode = ( 0 != bits.GetBits( 1 ) );
            _ButtonHasFilterList = ( 0 != bits.GetBits( 1 ) );
            _ButtonStateHitTest = ( 0 != bits.GetBits( 1 ) );
            _ButtonStateDown = ( 0 != bits.GetBits( 1 ) );
            _ButtonStateOver = ( 0 != bits.GetBits( 1 ) );
            _ButtonStateUp = ( 0 != bits.GetBits( 1 ) );

            BinaryReader br = new BinaryReader( input );

            _CharacterID = br.ReadUInt16();
            _PlaceDepth = br.ReadUInt16();
            _PlaceMatrix = new Matrix( this.Version );
            _PlaceMatrix.Parse( input );
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public void Parse( Stream input, TagTypes caller )
        {
            this._fillStyles.Parse( input, caller );
            this._lineStyles.Parse( input, caller );

            BitStream bits = new BitStream( input );

            this._numFillBits = (byte)bits.GetBits( 4 );
            this._numLineBits = (byte)bits.GetBits( 4 );
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="input"></param>
 /// <param name="bits"></param>
 public override void Parse(Stream input, BitStream bits)
 {
     bits.GetBits(6);
     bits.WriteFlush();
 }
Ejemplo n.º 14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="caller"></param>
        public virtual void TryParseShapeRecords(MemoryStream input, TagTypes caller)
        {
            BitStream bits = new BitStream(input);

            this._shapeRecords = new List<ShapeRecord>();

            StyleChangeRecord tempSCR = new StyleChangeRecord(this._SwfVersion);
            StraightEdgeRecord tempSER = new StraightEdgeRecord(this._SwfVersion);
            CurvedEdgeRecord tempCER = new CurvedEdgeRecord(this._SwfVersion);

            byte fiveBits = 0;
            bool endShapeRecordSeen = false;
            int numberOfStyleChanges = 0;

            UInt16 localNumFillBits = this._numFillBits;
            UInt16 localNumLineBits = this._numLineBits;

            do
            {
                bool typeFlag = (0 != bits.GetBits(1)) ? true : false;

                if (typeFlag)
                {
                    bool straightFlag = Convert.ToBoolean(bits.GetBits(1));

                    if (straightFlag)
                    {
                        tempSER = new StraightEdgeRecord(this._SwfVersion);
                        tempSER.Parse(input, bits);
                        this._shapeRecords.Add(tempSER);
                    }
                    else
                    {
                        tempCER = new CurvedEdgeRecord(this._SwfVersion);
                        tempCER.Parse(input, bits);
                        this._shapeRecords.Add(tempCER);
                    }
                }
                else
                {
                    fiveBits = (byte)bits.GetBits(5);

                    if (0 == fiveBits)
                    {
                        endShapeRecordSeen = true;
                    }
                    else
                    {
                        tempSCR = new StyleChangeRecord(this._SwfVersion);
                        tempSCR.Parse(input, bits, fiveBits, caller, ref localNumFillBits, ref localNumLineBits, 0 == numberOfStyleChanges ? true : false);
                        numberOfStyleChanges += 1;
                        this._shapeRecords.Add(tempSCR);
                    }
                }
            }
            while (!endShapeRecordSeen);
            bits.Reset();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="length"></param>
        /// <param name="caller"></param>
        public virtual void Parse(Stream input, Int64 length, TagTypes caller)
        {
            BitStream bits = new BitStream(input);

            this._numFillBits = (UInt16)bits.GetBits(4);
            this._numLineBits = (UInt16)bits.GetBits(4);

            if (length >= 1)
            {

                this._shapeRecordBuffer = new Byte[length - 1];
                input.Read(this._shapeRecordBuffer, 0, (Int32)length - 1);
                this._shapeRecordStream = new MemoryStream();

                this._shapeRecordStream.Write(this._shapeRecordBuffer, 0, this._shapeRecordBuffer.Length); // To protect the input stream
                this._shapeRecordStream.Seek(0, SeekOrigin.Begin);
                this.TryParseShapeRecords(this._shapeRecordStream, caller);

            }
            else
            {
                Log.Warn(this, "Attempt to parse shapes out of a too small field by: " + caller + ". Length was: " + length);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Parses this object out of a stream.
        /// </summary>
        /// <param name="input">The input Stream</param>
        /// <param name="length">The length of the ShapeRecords</param>
        /// <param name="caller">The tag that calls this method</param>
        public void Parse(Stream input, long length, TagTypes caller)
        {
            BitStream bits = new BitStream(input);

            this._fillStyles.Parse(input, caller);
            this._lineStyles.Parse(input, caller);

            this._numFillBits = (UInt16)bits.GetBits(4);
            this._numLineBits = (UInt16)bits.GetBits(4);

            this._shapeRecordBuffer = new Byte[length - 1];
            input.Read(this._shapeRecordBuffer, 0, (Int32)length - 1);

            // (Un)comment these lines to disbale/enable ShapeRecord pasing
            this._shapeRecordStream = new MemoryStream();
            this._shapeRecordStream.Write(this._shapeRecordBuffer, 0, this._shapeRecordBuffer.Length); // To protect the input stream
            this._shapeRecordStream.Seek(0, SeekOrigin.Begin);
            this.TryParseShapeRecords(this._shapeRecordStream, caller);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        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 );
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// TODO : Documentation
        /// </summary>
        /// <param name="source"></param>
        public void Parse( Stream source )
        {
            BitStream bits = new BitStream(source);

            if (source.Length < 1)
            {
                throw new ArgumentException("Source does not contain enough data. Length = " + source.Length.ToString("d"));
            }
            else
            {
                //
                // The first 5 bits declare how many bits per entry are used
                //
                _bits_per_entry = bits.GetBits(5);
            }
            _x_min = bits.GetBitsSigned( _bits_per_entry );
            _x_max = bits.GetBitsSigned( _bits_per_entry );
            _y_min = bits.GetBitsSigned( _bits_per_entry );
            _y_max = bits.GetBitsSigned( _bits_per_entry );
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="bits"></param>
        /// <param name="fillBits"></param>
        /// <param name="lineBits"></param>
        /// <param name="first"></param>
        private void ParseDefineShape23(Stream input, BitStream bits, ref UInt16 fillBits, ref UInt16 lineBits, bool first)
        {
            if (this._stateMoveTo)
            {
                this._moveBits = (byte)bits.GetBits(5);
                this._moveDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._moveBits);
                this._moveDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._moveBits);
            }

            if (this._stateFillStyle0)
            {
                this._fillStyle0 = bits.GetBits((UInt32)fillBits);
            }

            if (this._stateFillStyle1)
            {
                this._fillStyle1 = bits.GetBits((UInt32)fillBits);
            }
            if (this._stateLineStyle)
            {
                this._lineStyle = bits.GetBits((UInt32)lineBits);
            }
            if (this._stateNewStyles)
            {

                bits.Reset();
                this._fillStyles.Parse(input, this._caller);
                this._lineStyles.Parse(input, this._caller);
                this._newNumFillBits = (UInt16)bits.GetBits(4);
                this._newNumLineBits = (UInt16)bits.GetBits(4);
                fillBits = this._newNumFillBits;
                lineBits = this._newNumLineBits;

            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        /// <param name="bits"></param>
        public override void Parse(Stream output, BitStream bits)
        {
            this._numbits = (byte)bits.GetBits(4);

            this._controlDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._controlDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._anchorDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
            this._anchorDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._numbits + 2);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="input"></param>
 /// <param name="bits"></param>
 /// <param name="fillBits"></param>
 /// <param name="lineBits"></param>
 /// <param name="first"></param>
 private void ParseGeneric(Stream input, BitStream bits, ref UInt16 fillBits, ref UInt16 lineBits, bool first)
 {
     if (this._stateMoveTo)
     {
         this._moveBits = (byte)bits.GetBits(5);
         this._moveDeltaX = (Int32)bits.GetBitsSigned((UInt32)this._moveBits);
         this._moveDeltaY = (Int32)bits.GetBitsSigned((UInt32)this._moveBits);
     }
     if (this._stateFillStyle0)
     {
         this._fillStyle0 = bits.GetBits((UInt32)fillBits);
     }
     if (this._stateFillStyle1)
     {
         this._fillStyle1 = bits.GetBits((UInt32)fillBits);
     }
     if (this._stateLineStyle)
     {
         this._lineStyle = bits.GetBits((UInt32)lineBits);
     }
 }
Ejemplo n.º 22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public void Parse( Stream input )
        {
            BitStream bits = new BitStream( input );

            ClipEventKeyUp = ( 1 == bits.GetBits( 1 ) );            // 0
            ClipEventKeyDown = ( 1 == bits.GetBits( 1 ) );          // 1
            ClipEventMouseUp = ( 1 == bits.GetBits( 1 ) );          // 2
            ClipEventMouseDown = ( 1 == bits.GetBits( 1 ) );        // 3
            ClipEventMouseMove = ( 1 == bits.GetBits( 1 ) );        // 4
            ClipEventUnload = ( 1 == bits.GetBits( 1 ) );           // 5
            ClipEventEnterFrame = ( 1 == bits.GetBits( 1 ) );       // 6
            ClipEventLoad = ( 1 == bits.GetBits( 1 ) );             // 7
            if ( this.Version >= 6 )
            {
                // Swf6 and following
                ClipEventDragOver = ( 1 == bits.GetBits( 1 ) );
                ClipEventRollOut = ( 1 == bits.GetBits( 1 ) );
                ClipEventRollOver = ( 1 == bits.GetBits( 1 ) );
                ClipEventReleaseOutside = ( 1 == bits.GetBits( 1 ) );
                ClipEventRelease = ( 1 == bits.GetBits( 1 ) );
                ClipEventPress = ( 1 == bits.GetBits( 1 ) );
                ClipEventInitialize = ( 1 == bits.GetBits( 1 ) );
                ClipEventData = ( 1 == bits.GetBits( 1 ) );

                uint reserved = bits.GetBits( 5 );
                if ( 0 != reserved )
                {
                    throw new SwfFormatException( "Reserved flags (following ClipEventData) used in ClipEventFlags" );
                }

                // Swf6, used in Swf7
                if ( ( ClipEventConstruct = ( 1 == bits.GetBits( 1 ) ) ) && ( this.Version < 7 ) )
                {
                    throw new SwfFormatException( "ClipEventConstruct in Swf with Version < 7" );
                }
                ClipEventKeyPress = ( 1 == bits.GetBits( 1 ) );
                ClipEventDragOut = ( 1 == bits.GetBits( 1 ) );

                uint reserved2 = bits.GetBits( 8 );
                if ( 0 != reserved2 )
                {
                    throw new SwfFormatException( "Reserved flags (following ClipEventDragOut) used in ClipEventFlags" );
                }
            }
            else
            {
                //
                // Swf spec mentiones that CLIPEVENTFLAGS is 2 Bytes in
                // Swf.Version < 6, but doesn't specify a Reserved 8-Bit field
                // explicitly. So we handle it like one.
                //
                uint reservedB46 = bits.GetBits( 8 );
                if ( 0 != reservedB46 )
                {
                    throw new SwfFormatException( "Reserved flags (following ClipEventLoad) used in ClipEventFlags" );
                }
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public void Parse(Stream input)
        {
            BitStream bits = new BitStream(input);

            this._synchWord = (UInt16)bits.GetBits(11);
            this._MPEGVersion = (Byte)bits.GetBits(2);
            this._layer = (Byte)bits.GetBits(2);
            this._protectionBit = 1 == bits.GetBits(1) ? true : false;
            this._bitrate = (Byte)bits.GetBits(4);
            this._samplingRate = (Byte)bits.GetBits(2);
            this._paddingBit = 1 == bits.GetBits(1) ? true : false;
            bits.GetBits(1); //reserved
            this._channelMode = (Byte)bits.GetBits(2);
            this._modeExtension = (Byte)bits.GetBits(2);
            this._copyright = 1 == bits.GetBits(1) ? true : false;
            this._original = 1 == bits.GetBits(1) ? true : false;
            this._emphasis = (Byte)bits.GetBits(2);

            this._sampleData = new Byte[(Int32)(input.Length - input.Position)];
            input.Read(this._sampleData, 0, this._sampleData.Length);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="maxSize"></param>
        public void Parse( Stream input, uint maxSize )
        {
            BinaryReader br = new BinaryReader( input );

            //
            // subtract the OffsetToNextCondAction as well as the Conditions from
            // the available size
            //
            uint maxSizeInternal = maxSize - 4;

            _OffsetToNextCondAction = br.ReadUInt16();

            BitStream bits = new BitStream( input );
            _CondIdleToOverDown = ( 0 != bits.GetBits( 1 ) );
            _CondOutDownToIdle = ( 0 != bits.GetBits( 1 ) );
            _CondOutDownToOverDown = ( 0 != bits.GetBits( 1 ) );
            _CondOverDownToOutDown = ( 0 != bits.GetBits( 1 ) );
            _CondOverDownToOverUp = ( 0 != bits.GetBits( 1 ) );
            _CondOverUpToOverDown = ( 0 != bits.GetBits( 1 ) );
            _CondOverUpToIdle = ( 0 != bits.GetBits( 1 ) );
            _CondIdleToOverUp = ( 0 != bits.GetBits( 1 ) );
            _CondKeyPress = (byte)bits.GetBits( 7 );
            if ( ( 0 != _CondKeyPress ) && ( this.Version < 4 ) )
            {
                throw new SwfFormatException( "CondKeyPress != 0 with Swf version " + this.Version.ToString( "d" ) );
            }
            if (
                ( ( _CondKeyPress > 19 ) && ( _CondKeyPress < 32 ) )
                || ( _CondKeyPress > 126 )
                )
            {
                throw new SwfFormatException( "Illegal CondKeyPress " + _CondKeyPress.ToString("d") + " in ButtonCondAction" );
            }
            _CondOverDownToIdle = ( 0 != bits.GetBits( 1 ) );

            uint expectedSize;
            if ( 0 != _OffsetToNextCondAction )
            {
                //
                // if we have been given an offset, this defines our code
                // size expecations (minus 4 bytes for the previous data)
                //
                expectedSize = (uint)( _OffsetToNextCondAction - 4 );
            }
            else
            {
                //
                // if we have no offset, the caller must tell us how much
                // we have left
                //
                expectedSize = maxSizeInternal;
            }

            AVM1.AVM1InstructionSequence bytecode = Helper.SwfCodeReader.GetCode( expectedSize, br, this.Version );
            _Code = new AVM1.AVM1Code( bytecode );
        }