SwfDotNet.IO.Tags.BaseTagCollection.Add C# (CSharp) Method

Add() public method

Add a base tag
public Add ( BaseTag value ) : BaseTag
value BaseTag base tag to add
return BaseTag
        public BaseTag Add(BaseTag value)
        {
            List.Add(value as object);

            try
            {
                this.TagAdded(value);
            }
            catch (Exception) { }

            return value;
        }

Usage Example

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);
        }