Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader(_dataStream);

            UInt32 pt = br.ReadUInt32();
            if (!Enum.IsDefined(typeof(AdobeProductType), pt))
            {
                SwfFormatException sfe = new SwfFormatException("Invalid product type: " + pt.ToString("d"));
                Log.Error(this, sfe);
                throw sfe;
            }
            _ProductType = (AdobeProductType)pt;

            UInt32 pe = br.ReadUInt32();
            if (!Enum.IsDefined(typeof(AdobeProductEdition), pe))
            {
                SwfFormatException sfe = new SwfFormatException("Invalid product edition: " + pe.ToString("d"));
                Log.Error(this, sfe);
                throw sfe;
            }
            _ProductEdition = (AdobeProductEdition)pe;

            _MajorVersion = br.ReadByte();
            _MinorVersion = br.ReadByte();

            _BuildLow = br.ReadUInt32();
            _BuildHigh = br.ReadUInt32();
            _CompileTime = br.ReadUInt64();
        }
Esempio n. 2
0
        /// <summary>
        /// Writes this object back to a stream
        /// </summary>
        /// <param name="output">The stream to write to.</param>
        public void Write(Stream output)
        {
            log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            BitStream bits = new BitStream(output);

            bits.WriteBits(17, (Int32)this._pictureStartCode);
            bits.WriteBits(5, (Int32)this._version);
            bits.WriteBits(8, (Int32)this._temporalReference);
            bits.WriteBits(3, (Int32)this._pictureSize);

            if (this._pictureSize.Equals(0))
            {
                bits.WriteBits(8, (Int32)this._customWidth);
                bits.WriteBits(8, (Int32)this._customHeight);
            }
            else if (this._pictureSize.Equals(1))
            {
                bits.WriteBits(16, (Int32)this._customWidth);
                bits.WriteBits(16, (Int32)this._customHeight);
            }
            else
            {
                SwfFormatException e = new SwfFormatException("Not supported picture size.");
                log.Error(e.Message);
                throw e;
            }

            bits.WriteBits(2, (Int32)this._pictureType);
            bits.WriteBits(1, Convert.ToInt32(this._deblockingFlag));
            bits.WriteBits(5, (Int32)this._quantizer);
            bits.WriteBits(1, Convert.ToInt32(this._extraInformationFlag));
            bits.WriteFlush();

            if (this._extraInformationFlag)
            {
                for (int i = 0; i < this._extraInformation.Count; i++)
                {
                    output.WriteByte(this._extraInformation[i]);
                }
            }

            this._macroBlock.Write(output);
               // this._pictureStuffing.Write(output);
        }
Esempio n. 3
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        public void Parse(Stream input)
        {
            log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            BitStream bits = new BitStream(input);

            this._pictureStartCode = bits.GetBits(17);
            this._version = (byte)bits.GetBits(5);
            this._temporalReference = (byte)bits.GetBits(8);
            this._pictureSize = (byte)bits.GetBits(3);

            if (this._pictureSize.Equals(0))
            {
                this._customWidth = (UInt16)bits.GetBits(8);
                this._customHeight = (UInt16)bits.GetBits(8);
            }
            else if (this._pictureSize.Equals(1))
            {
                this._customWidth = (UInt16)bits.GetBits(16);
                this._customHeight = (UInt16)bits.GetBits(16);
            }
            else
            {
                SwfFormatException e = new SwfFormatException("Not supported picture size.");
                log.Error(e.Message);
                throw e;
            }
            this._pictureType = (byte)bits.GetBits(2);
            this._deblockingFlag = Convert.ToBoolean(bits.GetBits(1));
            this._quantizer = (byte)bits.GetBits(5);
            this._extraInformationFlag = Convert.ToBoolean(bits.GetBits(1));
            bits.Reset();

            BinaryReader br = new BinaryReader(input);
            byte tempByte = 0;

            if (this._extraInformationFlag)
            {
                this._extraInformation = new List<byte>();

                while (0 != (tempByte = br.ReadByte()))
                {
                    this._extraInformation.Add(tempByte);
                }
            }
            this._extraInformation.Add(0);

            this._macroBlock = new MacroBlock(this._SwfVersion);
            this._macroBlock.Parse(input);
            //this._pictureStuffing.Parse(input);
        }
Esempio n. 4
0
        /// <summary>
        /// 
        /// </summary>
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader( _dataStream );

            _UUID = br.ReadBytes( 16 );

            if ( 16 != _UUID.Length )
            {
                SwfFormatException sfe = new SwfFormatException( "UUID read is not 16 bytes long" );
                Log.Error(this,  sfe );
                throw sfe;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        protected override void Parse()
        {
            // Log.Debug(this, "Offset : " + _dataStream.Position);
            BinaryReader2 br = new BinaryReader2(this._dataStream);

            this._shapeID = br.ReadUInt16();

            this._shapeBounds.Parse(this._dataStream);
            this._edgeBounds.Parse(this._dataStream);

            BitStream bits = new BitStream(this._dataStream);

            this._reserved = (byte)bits.GetBits(5); //Reserved. Must be 0

            if (0 != this._reserved)
            {
                SwfFormatException e = new SwfFormatException(" Reserved bits has been set. ");
                Log.Warn(this, e.Message);
                //throw e;
            }

            this._usesFillWindingRule = 0 != bits.GetBits(1) ? true : false;
            this._usesNonScalingStrokes = 0 != bits.GetBits(1) ? true : false;
            this._usesScalingStrokes = 0 != bits.GetBits(1) ? true : false;

            Int64 shapesLength = this._dataStream.Length - this._dataStream.Position;
            this._shapes.Parse(this._dataStream, shapesLength, this._tag.TagType);
        }
Esempio n. 6
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader(this._dataStream);

            this._tagID = br.ReadUInt16();
            UInt32 reserved = br.ReadUInt32(); // reserved (must be 0);

            if (0 != reserved)
            {
                SwfFormatException e = new SwfFormatException("Reserved byte is not null.");
               Log.Error(this, e.Message);
                throw e;
            }

            this._data = new byte[this.Length - 6];
            int read = this._dataStream.Read(this._data, 0, this._data.Length);
        }
Esempio n. 7
0
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader(_dataStream);
            this._soundstreamhead = (SoundStreamHead)(this._SourceFileReference.TagHandlers.FindLast(isSoundStreamHead));

            if (_soundstreamhead == null)
            {
                SwfFormatException s = new SwfFormatException("No SoundStreamHead found");
                Log.Warn(this, s.Message);
                //throw s;
            }

            this.TryParseSoundData(this._dataStream);

            String s1 = String.Format("0x{0:X08}: reading soundstreamblock ({1} bytes)",
                this.Tag.OffsetData,
                this._soundData.Length);
            Log.Debug(this, s1);

            if (this.Head != null)
            {
                String s2 = String.Format("0x{0:X08}\tHead: Playback: {1} {2} {3}",
                    this.Head.Tag.OffsetData,
                    this.Head.PlaybackRate,
                    this.Head.PlaybackSize,
                    this.Head.PlaybackType);

                 Log.Debug(this, s2);

                String s3 = String.Format("0x{0:X08}\tHead: Stream: {1} {2} {3} {4}",
                    this.Head.Tag.OffsetData,
                    this.Head.StreamCompression,
                    this.Head.StreamRate,
                    this.Head.StreamSize,
                    this.Head.StreamType);
                 Log.Debug(this, s3);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader(this._dataStream);

            this._spriteID = br.ReadUInt16();
            this._frameCount = br.ReadUInt16();

            this._controlTags = new List<AbstractTagHandler>();

            Tag t;

            MemoryStream tempstream = new MemoryStream();
            long position = this._dataStream.Position;
            this._dataStream.WriteTo(tempstream);
            tempstream.Seek(position, SeekOrigin.Begin);

            do
            {
                t = new Tag();

                try
                {
                    tempstream = (MemoryStream)t.Read(tempstream);

                    this._controlTags.Add(TagHandlerFactory.Create(t, this._SourceFileReference, this._dataStream));

                    if (!this._allowedTags.Contains(t.TagType))
                    {
                        if (TagTypes.PlaceObject3 != t.TagType)
                        {
                            SwfFormatException e = new SwfFormatException("DefineSprite contains illegal tag.(" + t.TagType + ")");
                            Log.Warn(this, e.Message);
                            throw e;
                        }
                    }
                }
                catch ( IOException ioe )
                {
                   Log.Error(this, ioe );
                    SwfFormatException e = new SwfFormatException( "Tag list incomplete, does not end with END tag" );
                    Log.Warn(this,  e );
                    //throw e;
                }
            }
            while (!t.TagType.Equals(TagTypes.End));
        }
Esempio n. 9
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        protected override void Parse()
        {
            // We cannot parse code using the ParseCode() method, due to the
            // ButtonCondAction format
            BinaryReader2 br = new BinaryReader2( this._dataStream );
            long rememberStreamBegin = this._dataStream.Position;

            this._buttonID = br.ReadUInt16();
            BitStream bits = new BitStream( this._dataStream );
            uint reserved = bits.GetBits( 7 );
            if ( 0 != reserved )
            {
                throw new SwfFormatException( "DefineButton2 uses reserved bits" );
            }
               this._trackAsMenu = ( 0 != bits.GetBits( 1 ) );
            // Quote form spec: "Offset in bytes from start of this
            // field to the first BUTTONCONDACTION, or 0 if no actions occur"
               long rememberActionOffset = this._dataStream.Position;
            this._actionOffset = br.ReadUInt16();

            while ( 0 != br.PeekByte() )
            {
                ButtonRecord2 b = new ButtonRecord2( this.Version );
                b.Parse( this._dataStream );
                this._characters.Add( b );
            }
            // CharacterEndFlag
            br.ReadByte();

            //
            // Now, we can check the ActionOffset value
            //
            this._actions = new List<ButtonCondAction>();
            if ( 0 != this._actionOffset )
            {
                if ( ( rememberActionOffset + this._actionOffset ) != this._dataStream.Position )
                {
                    SwfFormatException e = new SwfFormatException(
                        "ActionOffset was 0x" + this._actionOffset.ToString( "X02" ) + " at stream position 0x" + rememberActionOffset.ToString( "X08" ) +
                        " but stream is now at 0x" + this._dataStream.Position.ToString( "X08" ) );
                   Log.Error(this,  e );
                    throw e;
                }

                ButtonCondAction cond = null;
                do
                {
                    cond = new ButtonCondAction( this.Version );
                    try
                    {
                        uint bytesLeft = ( uint )( this._tag.Length - ( this._dataStream.Position - rememberStreamBegin ) );
                        cond.Parse( this._dataStream, bytesLeft );
                    }
                    catch ( AVM1.AVM1Exception be )
                    {
                       Log.Error(this,  be );

                        if ( SwfFile.Configuration.AVM1DeleteInvalidBytecode )
                        {
                            cond.Code.Clear();
                        }
                        else
                        {
                            SwfFormatException swfe = new SwfFormatException( "DefineButton2 contains invalid ActionCode", be );
                            throw swfe;
                        }
                    }

                    this._actions.Add( cond );
                }
                while ( cond._OffsetToNextCondAction != 0 );
            }

            //
            // Scan the _SwfFile for a FileAttributes tag and see if it
            // specifies AS3. Spec quote: "Starting with Swf 9, if the ActionScript3 field
            // of the FileAttributes tag is 1, there must be no BUTTONCONDACTION fields in
            // the DefineButton2 tag. ActionOffset must be 0."
            //
            // TODO: implement me

            if ( this._dataStream.Position != this._dataStream.Length )
            {
                SwfFormatException e = new SwfFormatException(
                    "DefineButton2 has not fully consumed stream (" + this._dataStream.Position.ToString( "d" ) +
                    " of " + this._dataStream.Length.ToString( "d" )
                );
               Log.Error(this,  e );
                throw e;
            }

               //Log.Debug(this,  this.ToString() );
        }
Esempio n. 10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        public override void Write(Stream output)
        {
            this.WriteTagHeader(output);

            if (!this._fontNameLen.Equals(this._fontName.Length))
            {
                SwfFormatException e = new SwfFormatException("The font name length field and the length of the font name array must be equal!");
               Log.Error(this, e.Message);
                throw e;
            }

            byte[] fontID = BitConverter.GetBytes(this._fontID);
            output.Write(fontID, 0, 2);
            output.WriteByte(this._fontNameLen);
            output.Write(this._fontName, 0, this._fontNameLen);

            BitStream bits = new BitStream(output);

            bits.WriteBits(2, 0); // reserved bits

            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsSmallText));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsShiftJIS));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsANSI));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsItalic));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsBold));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsWideCodes));

            output.WriteByte((byte)this._languageCode);

            if (this._fontFlagsWideCodes)
            {
                byte[] tempArray = null;

                for (int i = 0; i < this._wideCodeTable.Count; i++)
                {
                    tempArray = BitConverter.GetBytes(this._codeTable[i]);
                    output.Write(tempArray, 0, 2);
                }
            }
            else
            {
                for (int i = 0; i < this._codeTable.Count; i++)
                {
                    output.WriteByte(this._codeTable[i]);
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Parses the flags of this object out of a stream.
        /// </summary>
        /// <param name="br">The BinaryReader</param>
        /// <param name="bs">The Bitstream</param>
        private void ParseFlags(BinaryReader br, BitStream bs)
        {
            this._PlaceFlagHasClipActions = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasClipDepth = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasName = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasRatio = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasColorTransform = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasMatrix = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasCharacter = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagMove = 0 != bs.GetBits(1) ? true : false;
            bs.GetBits(3); // Reserved
            this._PlaceFlagHasImage = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasClassName = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasCacheAsBitmap = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasBlendMode = 0 != bs.GetBits(1) ? true : false;
            this._PlaceFlagHasFilterList = 0 != bs.GetBits(1) ? true : false;
            bs.Reset();

            if (!(_PlaceFlagMove || _PlaceFlagHasCharacter))
            {
                SwfFormatException e = new SwfFormatException("Object is neither a creation (PlaceFlagHasCharacter) nor an update (PlaceFlagMove).");
                Log.Error(this, e.Message);
                throw e;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="expectedLength"></param>
        protected void ParseCode( uint expectedLength )
        {
            BinaryReader2 br = new BinaryReader2( this._dataStream );
            AVM1.AVM1InstructionSequence bytecode = null;

            Log.Debug(this,  "Parsing AVM1 code" );

            try
            {
                bytecode = Helper.SwfCodeReader.GetCode( expectedLength, br, this.Version );
            }
            catch ( AVM1.AVM1Exception be )
            {
                Log.Error(this,  be );

                if ( SwfFile.Configuration.AVM1DeleteInvalidBytecode)
                {
                    bytecode = new AVM1.AVM1InstructionSequence();
                }
                else
                {
                    SwfFormatException swfe = new SwfFormatException( "Tag with invalid byte code", be );
                    Log.Error(this, swfe);
                    throw swfe;
                }
            }

            this._code = new Recurity.Swf.AVM1.AVM1Code( bytecode );
               //Log.Debug(this,  this._code.Count.ToString() + " actions added" );
        }
Esempio n. 13
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static SoundEncoding getFormat(uint type)
        {
            if (type == 0)
                return SoundEncoding.uncompressed_native;

            else if(type == 1)
                return SoundEncoding.ADPCM;

            else if(type == 2)
                return SoundEncoding.MP3;

            else if(type == 3)
                return SoundEncoding.Uncompressed_little_endian;

            else if(type == 4)
                return SoundEncoding.Nellymoser8kHz;

            else if(type == 5)
                return SoundEncoding.Nellymoser16kHz;

            else if(type == 6)
                return SoundEncoding.Nellymoser;

            else if(type == 11)
                return SoundEncoding.Speex;

            SwfFormatException sfe = new SwfFormatException("coding format is not defined");
            Log.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.DeclaringType, sfe);
            throw sfe;
        }
Esempio n. 14
0
        /// <summary>
        /// 
        /// </summary>
        protected void ParsePlaceObject2Flags()
        {
            BitStream bits = new BitStream(_dataStream);

            _PlaceFlagHasClipActions = (0 != bits.GetBits(1));
            _PlaceFlagHasClipDepth = (0 != bits.GetBits(1));
            _PlaceFlagHasName = (0 != bits.GetBits(1));
            _PlaceFlagHasRatio = (0 != bits.GetBits(1));
            _PlaceFlagHasColorTransform = (0 != bits.GetBits(1));
            _PlaceFlagHasMatrix = (0 != bits.GetBits(1));
            _PlaceFlagHasCharacter = (0 != bits.GetBits(1));
            _PlaceFlagMove = (0 != bits.GetBits(1));

            if (!(_PlaceFlagMove || _PlaceFlagHasCharacter))
            {
                SwfFormatException e = new SwfFormatException("Object is neither a creation (PlaceFlagHasCharacter) nor an update (PlaceFlagMove).");
                Log.Error(this, e.Message);
                throw e;
            }

            // Flag only exists for Swf5 and later
            if (_PlaceFlagHasClipActions && (this.Version < 5))
            {
                SwfFormatException e = new SwfFormatException("PlaceFlagHasClipActions in Swf Version " + this.Version.ToString());
                Log.Error(this, e);
                throw e;
            }
        }
Esempio n. 15
0
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader(this._dataStream);
            BitStream bits = new BitStream(this._dataStream);

            ushort _reserved = (ushort)bits.GetBits(4);
            this._playbacksoundrate = DefineSound.getSoundRate(bits.GetBits(2));
            this._playbacksoundsize = (bits.GetBits(1) == 0) ? SoundSize.snd_8bit : SoundSize.snd_16bit;
            this._playbacksoundtype = (bits.GetBits(1) == 0) ? SoundType.mono : SoundType.stereo;

            this._streamsoundcompression = DefineSound.getFormat(bits.GetBits(4));
            this._streamsoundrate = DefineSound.getSoundRate(bits.GetBits(2));
            this._streamsoundsize = (bits.GetBits(1) == 0) ? SoundSize.snd_8bit : SoundSize.snd_16bit;
            this._streamsoundtype = (bits.GetBits(1) == 0) ? SoundType.mono : SoundType.stereo;

            this._streamsoundsamplecount = br.ReadUInt16();

            if (_streamsoundcompression == SoundEncoding.MP3)
                this._latencyseek = br.ReadInt16();

            if (_reserved != 0)
            {
                Exception e = new SwfFormatException("Reserved bits are set");
                Log.Warn(this, e);
            }
            String s1 = String.Format("0x{0:X08}: reading soundstreamhead. Avarage samples {1}", this.Tag.OffsetData, this.AvarageCount);
            Log.Debug(this, s1);

               String s2 = String.Format("0x{0:X08}:\tPlayback: {1} {2} {3}",
                this.Tag.OffsetData,
                this.PlaybackRate,
                this.PlaybackSize,
                this.PlaybackType);
               Log.Debug(this, s2);

               String s3 = String.Format("0x{0:X08}:\tStream:   {1} {2} {3} {4}",
                this.Tag.OffsetData,
                this.StreamCompression,
                this.StreamRate,
                this.StreamSize,
                this.StreamType);
               Log.Debug(this, s3);
        }
Esempio n. 16
0
        private void TryParseSoundData(Stream input)
        {
            Byte[] b = new Byte[(Int32)(input.Length - input.Position)];
            Int64 position = this._dataStream.Position;
            input.Read(b, 0, b.Length);
            input.Seek(position, SeekOrigin.Begin);

            if (_soundstreamhead != null)
            {
                switch (this._soundstreamhead.StreamCompression)
                {
                    case SoundEncoding.uncompressed_native:
                        RawSoundData rawDataN = new RawSoundData(b, false);
                        this._soundData = rawDataN;
                        break;
                    case SoundEncoding.Uncompressed_little_endian:
                        RawSoundData rawDataL = new RawSoundData(b, true);
                        this._soundData = rawDataL;
                        break;
                    case SoundEncoding.ADPCM:
                        AdpcmSoundData ADPCMData = new AdpcmSoundData();
                        ADPCMData.Parse(input, this._soundstreamhead.StreamType);
                        this._soundData = ADPCMData;
                        break;
                    case SoundEncoding.MP3:
                        Mp3SoundData mp3Data = new Mp3SoundData();
                        mp3Data.Parse(input);
                        this._soundData = mp3Data;
                        break;
                    case SoundEncoding.Nellymoser:
                        NellymoserSoundData nellySound = new NellymoserSoundData(b);
                        this._soundData = nellySound;
                        break;
                    case SoundEncoding.Nellymoser8kHz:
                        Nellymoser8SoundData nelly8Sound = new Nellymoser8SoundData(b);
                        this._soundData = nelly8Sound;
                        break;
                    case SoundEncoding.Nellymoser16kHz:
                        Nellymoser16SoundData nelly16Sound = new Nellymoser16SoundData(b);
                        this._soundData = nelly16Sound;
                        break;
                    default:
                        SwfFormatException e = new SwfFormatException("Unsupported sound encoding found in sound stream block.");
                        Log.Error(this, e.Message);
                        throw e;
                }
            }
            else
            {
                this._soundData = new RawSoundData(b);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 
        /// </summary>
        protected override void Parse()
        {
            if (_tag.Length < 4)
            {
                SwfFormatException e = new SwfFormatException("FileAttributes Tag too short.");
                Log.Error(this, e);
                throw e;
            }

            _ReservedBitsDetectedWhileParsing = false;
            BitStream bits = new BitStream(_dataStream);

            if (0 != bits.GetBits(1))
            {
                _ReservedBitsDetectedWhileParsing = true;
            }

            _UseDirectBlit = (0 != bits.GetBits(1));
            _UseGPU = (0 != bits.GetBits(1));
            _HasMetadata = (0 != bits.GetBits(1));
            _ActionScript3 = (0 != bits.GetBits(1));

            if (0 != bits.GetBits(2))
            {
                _ReservedBitsDetectedWhileParsing = true;
            }

            _UseNetwork = (0 != bits.GetBits(1));

            if (0 != bits.GetBits(24))
            {
                _ReservedBitsDetectedWhileParsing = true;
            }

            if (_ReservedBitsDetectedWhileParsing)
            {
                Log.Warn(this, "Reserved Bits used in FileAttributes");
            }

            StringBuilder sb = new StringBuilder();
            sb.Append("Attributes:");
            sb.Append(" UseDirectBlit:"); sb.Append(_UseDirectBlit);
            sb.Append(" UseGPU:"); sb.Append(_UseGPU);
            sb.Append(" HasMetadata:"); sb.Append(_HasMetadata);
            sb.Append(" ActionScript3:"); sb.Append(_ActionScript3);
            sb.Append(" UseNetwork:"); sb.Append(_UseNetwork);
            //Log.Debug(this, sb.ToString());
        }
Esempio n. 18
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader(this._dataStream);

            this._characterID = br.ReadUInt16();
            this._numberOfFrames = br.ReadUInt16();
            this._width = br.ReadUInt16();
            this._height = br.ReadUInt16();

            BitStream bits = new BitStream(this._dataStream);

            UInt32 reserved = bits.GetBits(4); // muste be 0

            if (0 != reserved)
            {
                SwfFormatException e = new SwfFormatException("Reserved bits havae been set");
               Log.Error(this, e.Message);
                throw e;
            }

            this._videoFlagsDeblocking = (VideoFlagsDeblocking)bits.GetBits(3);
            this._videoFlagsSmoothing = (0 != bits.GetBits(1) ? true : false);
            this._codecID = (CodecID)this._dataStream.ReadByte();
        }