ReadTag() static private method

Read next tag from swf input stream.
static private ReadTag ( byte version, BufferedBinaryReader binaryReader, BaseTagCollection tagList ) : BaseTag
version byte Version.
binaryReader SwfDotNet.IO.Utils.BufferedBinaryReader Binary reader.
tagList SwfDotNet.IO.Tags.BaseTagCollection Tag list.
return SwfDotNet.IO.Tags.BaseTag
Example #1
0
        /// <summary>
        /// Read swf (header and tags), this is the only
        /// public method of <see cref="SwfDotNet.IO.SwfReader">SwfReader</see>
        /// with <see cref="SwfDotNet.IO.SwfReader.Close">Close</see> and
        /// <see cref="SwfDotNet.IO.SwfReader.ReadSwfHeader">ReadSwfHeader</see> methods.
        /// The returned <see cref="SwfDotNet.IO.Swf">Swf</see> object contains swf headers informations and the
        /// tags list.
        /// </summary>
        public Swf ReadSwf()
        {
            // compressed swf?
            if (br.PeekChar() == 'C')
            {
                Inflate();
            }

            SwfHeader header = new SwfHeader();

            header.ReadData(br);
            this.version = header.Version;

            tagList = new BaseTagCollection();

            bool readEndTag = false; //necessary for the 1 more byte bug

            while (br.BaseStream.Position < br.BaseStream.Length && !readEndTag)
            {
                BaseTag b = SwfReader.ReadTag(this.version, this.br, this.tagList);
                if (b != null)
                {
                    if (b is EndTag)
                    {
                        readEndTag = true;
                    }
                    tagList.Add(b);
                }
            }
            ;

            br.Close();

            return(new Swf(header, tagList));
        }