/// <summary>
        ///
        /// </summary>
        /// <param name="mo"></param>
        /// <param name="writeProperties"></param>
        /// <param name="shouldPrintResources"></param>
        /// <param name="writeResources"></param>
        /// <param name="writeDescNodes"></param>
        /// <param name="formatter"></param>
        /// <param name="data"></param>
        /// <param name="xmlWriter"></param>
        public static void WriteInnerXml(
            IUPnPMedia mo,
            DelegateWriteProperties writeProperties,
            DelegateShouldPrintResources shouldPrintResources,
            DelegateWriteResources writeResources,
            DelegateWriteDescNodes writeDescNodes,
            ToXmlFormatter formatter,
            ToXmlData data,
            XmlTextWriter xmlWriter
            )
        {
            // When serializing the properties, resources, and desc nodes,
            // we must always write the inner xml, the value, and the element
            // declaration. Save the original values, print these portions
            // of the DIDL-Lite and then revert back.

            ToXmlData d2 = data;

            data.IncludeElementDeclaration = true;
            data.IncludeInnerXml           = true;
            data.IncludeValue = true;

            if (writeProperties != null)
            {
                writeProperties(mo, data, xmlWriter);
            }

            if (writeResources != null)
            {
                writeResources(mo, shouldPrintResources, formatter, data, xmlWriter);
            }

            if (writeDescNodes != null)
            {
                writeDescNodes(mo, data, xmlWriter);
            }

            data.IncludeElementDeclaration = d2.IncludeElementDeclaration;
            data.IncludeInnerXml           = d2.IncludeInnerXml;
            data.IncludeValue = d2.IncludeValue;

            IMediaContainer mc = mo as IMediaContainer;

            if (mc != null)
            {
                if (data.IsRecursive)
                {
                    foreach (IUPnPMedia child in mc.CompleteList)
                    {
                        ToXmlFormatter f2 = formatter;
                        f2.StartElement  = null;
                        f2.EndElement    = null;
                        f2.WriteInnerXml = null;
                        f2.WriteValue    = null;

                        child.ToXml(f2, data, xmlWriter);
                    }
                }
            }
        }
Пример #2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="mo"></param>
		/// <param name="writeProperties"></param>
		/// <param name="shouldPrintResources"></param>
		/// <param name="writeResources"></param>
		/// <param name="writeDescNodes"></param>
		/// <param name="formatter"></param>
		/// <param name="data"></param>
		/// <param name="xmlWriter"></param>
		public static void WriteInnerXml (
			IUPnPMedia mo, 
			DelegateWriteProperties writeProperties, 
			DelegateShouldPrintResources shouldPrintResources, 
			DelegateWriteResources writeResources, 
			DelegateWriteDescNodes writeDescNodes, 
			ToXmlFormatter formatter, 
			ToXmlData data, 
			XmlTextWriter xmlWriter
			)
		{
			// When serializing the properties, resources, and desc nodes,
			// we must always write the inner xml, the value, and the element
			// declaration. Save the original values, print these portions
			// of the DIDL-Lite and then revert back.

			ToXmlData d2 = data;
			
			data.IncludeElementDeclaration = true;
			data.IncludeInnerXml = true;
			data.IncludeValue = true;

			if (writeProperties != null)
			{
				writeProperties(mo, data, xmlWriter); 
			}
			
			if (writeResources != null) 
			{
				writeResources(mo, shouldPrintResources, formatter, data, xmlWriter); 
			}
			
			if (writeDescNodes != null) 
			{
				writeDescNodes(mo, data, xmlWriter); 
			}

			data.IncludeElementDeclaration = d2.IncludeElementDeclaration;
			data.IncludeInnerXml = d2.IncludeInnerXml;
			data.IncludeValue = d2.IncludeValue;

			IMediaContainer mc = mo as IMediaContainer;
			if (mc != null)
			{
				if (data.IsRecursive)
				{
					foreach (IUPnPMedia child in mc.CompleteList)
					{
						ToXmlFormatter f2 = formatter;
						f2.StartElement = null;
						f2.EndElement = null;
						f2.WriteInnerXml = null;
						f2.WriteValue = null;

						child.ToXml(f2, data, xmlWriter);
					}
				}
			}
		}