Пример #1
0
        /// <summary>
        /// Compares the collections for objects that implement the <see cref="IYahooMediaCommonObjectEntities"/> interface.
        /// </summary>
        /// <param name="source">A object that implements the <see cref="IYahooMediaCommonObjectEntities"/> interface to be compared.</param>
        /// <param name="target">A object that implements the <see cref="IYahooMediaCommonObjectEntities"/> to compare with the <paramref name="source"/>.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        private static int CompareCommonObjectEntityCollections(IYahooMediaCommonObjectEntities source, IYahooMediaCommonObjectEntities target)
        {
            int result = 0;

            if (source == null && target == null)
            {
                return(0);
            }
            else if (source != null && target == null)
            {
                return(1);
            }
            else if (source == null && target != null)
            {
                return(-1);
            }
            result = result | YahooMediaUtility.CompareSequence(source.Categories, target.Categories);
            result = result | YahooMediaUtility.CompareSequence(source.Credits, target.Credits);
            result = result | YahooMediaUtility.CompareSequence(source.Hashes, target.Hashes);
            result = result | ComparisonUtility.CompareSequence(source.Keywords, target.Keywords, StringComparison.OrdinalIgnoreCase);
            result = result | YahooMediaUtility.CompareSequence(source.Ratings, target.Ratings);
            result = result | YahooMediaUtility.CompareSequence(source.Restrictions, target.Restrictions);
            result = result | YahooMediaUtility.CompareSequence(source.TextSeries, target.TextSeries);
            result = result | YahooMediaUtility.CompareSequence(source.Thumbnails, target.Thumbnails);

            return(result);
        }
        //============================================================
        //	ICOMPARABLE IMPLEMENTATION
        //============================================================
        #region CompareTo(object obj)
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            //------------------------------------------------------------
            //	If target is a null reference, instance is greater
            //------------------------------------------------------------
            if (obj == null)
            {
                return(1);
            }

            //------------------------------------------------------------
            //	Determine comparison result using property state of objects
            //------------------------------------------------------------
            YahooMediaSyndicationExtension value = obj as YahooMediaSyndicationExtension;

            if (value != null)
            {
                int result = YahooMediaUtility.CompareSequence((Collection <YahooMediaContent>) this.Context.Contents, (Collection <YahooMediaContent>)value.Context.Contents);
                result = result | YahooMediaUtility.CompareSequence((Collection <YahooMediaGroup>) this.Context.Groups, (Collection <YahooMediaGroup>)value.Context.Groups);

                result = result | YahooMediaUtility.CompareCommonObjectEntities(this.Context, value.Context);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
Пример #3
0
        /// <summary>
        /// Loads this <see cref="YahooMediaGroup"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="YahooMediaGroup"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="YahooMediaGroup"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension();
            XmlNamespaceManager            manager   = extension.CreateNamespaceManager(source);

            if (source.HasChildren)
            {
                XPathNodeIterator contentIterator = source.Select("media:content", manager);

                if (contentIterator != null && contentIterator.Count > 0)
                {
                    while (contentIterator.MoveNext())
                    {
                        YahooMediaContent content = new YahooMediaContent();
                        if (content.Load(contentIterator.Current))
                        {
                            this.Contents.Add(content);
                            wasLoaded = true;
                        }
                    }
                }
            }

            if (YahooMediaUtility.FillCommonObjectEntities(this, source))
            {
                wasLoaded = true;
            }

            return(wasLoaded);
        }
Пример #4
0
        /// <summary>
        /// Saves the current <see cref="YahooMediaGroup"/> to the specified <see cref="XmlWriter"/>.
        /// </summary>
        /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception>
        public void WriteTo(XmlWriter writer)
        {
            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(writer, "writer");

            //------------------------------------------------------------
            //	Create extension instance to retrieve XML namespace
            //------------------------------------------------------------
            YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension();

            //------------------------------------------------------------
            //	Write XML representation of the current instance
            //------------------------------------------------------------
            writer.WriteStartElement("group", extension.XmlNamespace);

            foreach (YahooMediaContent content in this.Contents)
            {
                content.WriteTo(writer);
            }

            YahooMediaUtility.WriteCommonObjectEntities(this, writer);

            writer.WriteEndElement();
        }
        //============================================================
        //	PUBLIC METHODS
        //============================================================
        #region Load(XPathNavigator source, XmlNamespaceManager manager)
        /// <summary>
        /// Initializes the syndication extension context using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <b>XPathNavigator</b> used to load this <see cref="YahooMediaSyndicationExtensionContext"/>.</param>
        /// <param name="manager">The <see cref="XmlNamespaceManager"/> object used to resolve prefixed syndication extension elements and attributes.</param>
        /// <returns><b>true</b> if the <see cref="YahooMediaSyndicationExtensionContext"/> was able to be initialized using the supplied <paramref name="source"/>; otherwise <b>false</b>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="manager"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, XmlNamespaceManager manager)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasLoaded = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(manager, "manager");

            //------------------------------------------------------------
            //	Attempt to extract syndication extension information
            //------------------------------------------------------------
            if (source.HasChildren)
            {
                XPathNodeIterator contentIterator = source.Select("media:content", manager);
                XPathNodeIterator groupIterator   = source.Select("media:group", manager);

                if (contentIterator != null && contentIterator.Count > 0)
                {
                    while (contentIterator.MoveNext())
                    {
                        YahooMediaContent content = new YahooMediaContent();
                        if (content.Load(contentIterator.Current))
                        {
                            this.AddContent(content);
                            wasLoaded = true;
                        }
                    }
                }

                if (groupIterator != null && groupIterator.Count > 0)
                {
                    while (groupIterator.MoveNext())
                    {
                        YahooMediaGroup group = new YahooMediaGroup();
                        if (group.Load(groupIterator.Current))
                        {
                            this.AddGroup(group);
                            wasLoaded = true;
                        }
                    }
                }
            }

            if (YahooMediaUtility.FillCommonObjectEntities(this, source))
            {
                wasLoaded = true;
            }

            return(wasLoaded);
        }
Пример #6
0
        /// <summary>
        /// Saves the current <see cref="YahooMediaGroup"/> to the specified <see cref="XmlWriter"/>.
        /// </summary>
        /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception>
        public void WriteTo(XmlWriter writer)
        {
            Guard.ArgumentNotNull(writer, "writer");
            YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension();

            writer.WriteStartElement("group", extension.XmlNamespace);

            foreach (YahooMediaContent content in this.Contents)
            {
                content.WriteTo(writer);
            }

            YahooMediaUtility.WriteCommonObjectEntities(this, writer);

            writer.WriteEndElement();
        }
        /// <summary>
        /// Writes the current context to the specified <see cref="XmlWriter"/>.
        /// </summary>
        /// <param name="writer">The <b>XmlWriter</b> to which you want to write the current context.</param>
        /// <param name="xmlNamespace">The XML namespace used to qualify prefixed syndication extension elements and attributes.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="xmlNamespace"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="xmlNamespace"/> is an empty string.</exception>
        public void WriteTo(XmlWriter writer, string xmlNamespace)
        {
            Guard.ArgumentNotNull(writer, "writer");
            Guard.ArgumentNotNullOrEmptyString(xmlNamespace, "xmlNamespace");
            foreach (YahooMediaContent content in this.Contents)
            {
                content.WriteTo(writer);
            }

            foreach (YahooMediaGroup group in this.Groups)
            {
                group.WriteTo(writer);
            }

            YahooMediaUtility.WriteCommonObjectEntities(this, writer);
        }
Пример #8
0
        //============================================================
        //	PUBLIC METHODS
        //============================================================
        #region Load(XPathNavigator source)
        /// <summary>
        /// Loads this <see cref="YahooMediaGroup"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="YahooMediaGroup"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="YahooMediaGroup"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasLoaded = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(source, "source");

            //------------------------------------------------------------
            //	Initialize XML namespace resolver
            //------------------------------------------------------------
            YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension();
            XmlNamespaceManager            manager   = extension.CreateNamespaceManager(source);

            //------------------------------------------------------------
            //	Attempt to extract syndication information
            //------------------------------------------------------------
            if (source.HasChildren)
            {
                XPathNodeIterator contentIterator = source.Select("media:content", manager);

                if (contentIterator != null && contentIterator.Count > 0)
                {
                    while (contentIterator.MoveNext())
                    {
                        YahooMediaContent content = new YahooMediaContent();
                        if (content.Load(contentIterator.Current))
                        {
                            this.Contents.Add(content);
                            wasLoaded = true;
                        }
                    }
                }
            }

            if (YahooMediaUtility.FillCommonObjectEntities(this, source))
            {
                wasLoaded = true;
            }

            return(wasLoaded);
        }
        /// <summary>
        /// Initializes the syndication extension context using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <b>XPathNavigator</b> used to load this <see cref="YahooMediaSyndicationExtensionContext"/>.</param>
        /// <param name="manager">The <see cref="XmlNamespaceManager"/> object used to resolve prefixed syndication extension elements and attributes.</param>
        /// <returns><b>true</b> if the <see cref="YahooMediaSyndicationExtensionContext"/> was able to be initialized using the supplied <paramref name="source"/>; otherwise <b>false</b>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="manager"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, XmlNamespaceManager manager)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(manager, "manager");
            if (source.HasChildren)
            {
                XPathNodeIterator contentIterator = source.Select("media:content", manager);
                XPathNodeIterator groupIterator   = source.Select("media:group", manager);

                if (contentIterator != null && contentIterator.Count > 0)
                {
                    while (contentIterator.MoveNext())
                    {
                        YahooMediaContent content = new YahooMediaContent();
                        if (content.Load(contentIterator.Current))
                        {
                            this.AddContent(content);
                            wasLoaded = true;
                        }
                    }
                }

                if (groupIterator != null && groupIterator.Count > 0)
                {
                    while (groupIterator.MoveNext())
                    {
                        YahooMediaGroup group = new YahooMediaGroup();
                        if (group.Load(groupIterator.Current))
                        {
                            this.AddGroup(group);
                            wasLoaded = true;
                        }
                    }
                }
            }

            if (YahooMediaUtility.FillCommonObjectEntities(this, source))
            {
                wasLoaded = true;
            }

            return(wasLoaded);
        }
Пример #10
0
        /// <summary>
        /// Loads this <see cref="YahooMediaContent"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="YahooMediaContent"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="YahooMediaContent"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            wasLoaded = this.LoadPrimary(source);

            if (this.LoadSecondary(source))
            {
                wasLoaded = true;
            }

            if (YahooMediaUtility.FillCommonObjectEntities(this, source))
            {
                wasLoaded = true;
            }

            return(wasLoaded);
        }
Пример #11
0
        /// <summary>
        /// Compares objects that implement the <see cref="IYahooMediaCommonObjectEntities"/> interface.
        /// </summary>
        /// <param name="source">A object that implements the <see cref="IYahooMediaCommonObjectEntities"/> interface to be compared.</param>
        /// <param name="target">A object that implements the <see cref="IYahooMediaCommonObjectEntities"/> to compare with the <paramref name="source"/>.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        public static int CompareCommonObjectEntities(IYahooMediaCommonObjectEntities source, IYahooMediaCommonObjectEntities target)
        {
            int result = 0;

            if (source == null && target == null)
            {
                return(0);
            }
            else if (source != null && target == null)
            {
                return(1);
            }
            else if (source == null && target != null)
            {
                return(-1);
            }
            result = result | YahooMediaUtility.CompareCommonObjectEntityClasses(source, target);
            result = result | YahooMediaUtility.CompareCommonObjectEntityCollections(source, target);

            return(result);
        }
Пример #12
0
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            YahooMediaGroup value = obj as YahooMediaGroup;

            if (value != null)
            {
                int result = YahooMediaUtility.CompareSequence(this.Contents, value.Contents);

                result = result | YahooMediaUtility.CompareCommonObjectEntities(this, value);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
Пример #13
0
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            YahooMediaContent value = obj as YahooMediaContent;

            if (value != null)
            {
                int result = this.Bitrate.CompareTo(value.Bitrate);
                result = result | this.Channels.CompareTo(value.Channels);
                result = result | String.Compare(this.ContentType, value.ContentType, StringComparison.OrdinalIgnoreCase);
                result = result | this.Duration.CompareTo(value.Duration);
                result = result | this.Expression.CompareTo(value.Expression);
                result = result | this.FileSize.CompareTo(value.FileSize);
                result = result | this.FrameRate.CompareTo(value.FrameRate);
                result = result | this.Height.CompareTo(value.Height);
                result = result | this.IsDefault.CompareTo(value.IsDefault);

                string sourceLanguageName = this.Language != null ? this.Language.Name : String.Empty;
                string targetLanguageName = value.Language != null ? value.Language.Name : String.Empty;
                result = result | String.Compare(sourceLanguageName, targetLanguageName, StringComparison.OrdinalIgnoreCase);

                result = result | this.Medium.CompareTo(value.Medium);
                result = result | this.SamplingRate.CompareTo(value.SamplingRate);
                result = result | Uri.Compare(this.Url, value.Url, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                result = result | this.Width.CompareTo(value.Width);

                result = result | YahooMediaUtility.CompareCommonObjectEntities(this, value);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
        /// <summary>
        /// Writes the current context to the specified <see cref="XmlWriter"/>.
        /// </summary>
        /// <param name="writer">The <b>XmlWriter</b> to which you want to write the current context.</param>
        /// <param name="xmlNamespace">The XML namespace used to qualify prefixed syndication extension elements and attributes.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="xmlNamespace"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="xmlNamespace"/> is an empty string.</exception>
        public void WriteTo(XmlWriter writer, string xmlNamespace)
        {
            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(writer, "writer");
            Guard.ArgumentNotNullOrEmptyString(xmlNamespace, "xmlNamespace");

            //------------------------------------------------------------
            //	Write current extension details to the writer
            //------------------------------------------------------------
            foreach (YahooMediaContent content in this.Contents)
            {
                content.WriteTo(writer);
            }

            foreach (YahooMediaGroup group in this.Groups)
            {
                group.WriteTo(writer);
            }

            YahooMediaUtility.WriteCommonObjectEntities(this, writer);
        }
Пример #15
0
        /// <summary>
        /// Modifies the <see cref="IYahooMediaCommonObjectEntities"/> to match the data source.
        /// </summary>
        /// <param name="target">The object that implements the <see cref="IYahooMediaCommonObjectEntities"/> interface to be filled.</param>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract Yahoo media common entity information from.</param>
        /// <returns><b>true</b> if the <paramref name="target"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="target"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public static bool FillCommonObjectEntities(IYahooMediaCommonObjectEntities target, XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(target, "target");
            Guard.ArgumentNotNull(source, "source");
            YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension();
            XmlNamespaceManager            manager   = extension.CreateNamespaceManager(source);

            wasLoaded = YahooMediaUtility.FillCommonObjectEntityClasses(target, source, manager);

            if (YahooMediaUtility.FillCommonObjectEntityCollectionsPrimary(target, source, manager))
            {
                wasLoaded = true;
            }

            if (YahooMediaUtility.FillCommonObjectEntityCollectionsSecondary(target, source, manager))
            {
                wasLoaded = true;
            }

            return(wasLoaded);
        }
Пример #16
0
        /// <summary>
        /// Saves the current <see cref="YahooMediaContent"/> to the specified <see cref="XmlWriter"/>.
        /// </summary>
        /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception>
        public void WriteTo(XmlWriter writer)
        {
            Guard.ArgumentNotNull(writer, "writer");
            YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension();

            writer.WriteStartElement("content", extension.XmlNamespace);

            if (this.Url != null)
            {
                writer.WriteAttributeString("url", this.Url.ToString());
            }

            if (this.FileSize != Int64.MinValue)
            {
                writer.WriteAttributeString("fileSize", this.FileSize.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (!String.IsNullOrEmpty(this.ContentType))
            {
                writer.WriteAttributeString("type", this.ContentType);
            }

            if (this.Medium != YahooMediaMedium.None)
            {
                writer.WriteAttributeString("medium", YahooMediaSyndicationExtension.MediumAsString(this.Medium));
            }

            if (this.IsDefault)
            {
                writer.WriteAttributeString("isDefault", "true");
            }

            if (this.Expression != YahooMediaExpression.None)
            {
                writer.WriteAttributeString("expression", YahooMediaSyndicationExtension.ExpressionAsString(this.Expression));
            }

            if (this.Bitrate != Int32.MinValue)
            {
                writer.WriteAttributeString("bitrate", this.Bitrate.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (this.FrameRate != Int32.MinValue)
            {
                writer.WriteAttributeString("framerate", this.FrameRate.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (this.SamplingRate != Decimal.MinValue)
            {
                writer.WriteAttributeString("samplingrate", this.SamplingRate.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (this.Channels != Int32.MinValue)
            {
                writer.WriteAttributeString("channels", this.Channels.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (this.Duration != TimeSpan.MinValue)
            {
                writer.WriteAttributeString("duration", this.Duration.TotalSeconds.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (this.Height != Int32.MinValue)
            {
                writer.WriteAttributeString("height", this.Height.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (this.Width != Int32.MinValue)
            {
                writer.WriteAttributeString("width", this.Width.ToString(NumberFormatInfo.InvariantInfo));
            }

            if (this.Language != null)
            {
                writer.WriteAttributeString("lang", this.Language.Name);
            }

            YahooMediaUtility.WriteCommonObjectEntities(this, writer);

            writer.WriteEndElement();
        }