Esempio n. 1
0
 public static void Save(object obj, XamlDesignerSerializationManager manager)
 {
     SecurityHelper.DemandUnmanagedCode();
     if (obj == null)
     {
         throw new ArgumentNullException("obj");
     }
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     MarkupWriter.SaveAsXml(manager.XmlWriter, obj, manager);
 }
Esempio n. 2
0
        /// <summary>
        ///     Save writes the xml respresentation
        ///     for the given object instance using the
        ///     given XmlTextWriter embedded in the manager.
        /// </summary>
        /// <param name="obj">
        ///     Object instance
        /// </param>
        /// <param name="manager">
        ///     Serialization Manager
        /// </param>
        /// <remarks>
        ///     This API requires unmanaged code permission
        /// </remarks>
        public static void Save(object obj, XamlDesignerSerializationManager manager)
        {
            // Validate input arguments
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            MarkupWriter.SaveAsXml(manager.XmlWriter, obj, manager);
        }
Esempio n. 3
0
        public static void Save(object obj, Stream stream)
        {
            SecurityHelper.DemandUnmanagedCode();
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            XmlTextWriter writer = new XmlTextWriter(stream, null);

            MarkupWriter.SaveAsXml(writer, obj);
        }
Esempio n. 4
0
        public static void Save(object obj, TextWriter writer)
        {
            SecurityHelper.DemandUnmanagedCode();
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            XmlTextWriter writer2 = new XmlTextWriter(writer);

            MarkupWriter.SaveAsXml(writer2, obj);
        }
Esempio n. 5
0
        /// <summary>
        ///     Save writes the xml respresentation
        ///     for the given object instance using the given writer
        /// </summary>
        /// <param name="obj">
        ///     Object instance
        /// </param>
        /// <param name="writer">
        ///     Text Writer
        /// </param>
        /// <remarks>
        ///     This API requires unmanaged code permission
        /// </remarks>
        public static void Save(object obj, TextWriter writer)
        {
            // Validate input arguments
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            // Create XmlTextWriter
            XmlTextWriter xmlWriter = new XmlTextWriter(writer);

            MarkupWriter.SaveAsXml(xmlWriter, obj);
        }
Esempio n. 6
0
        /// <summary>
        ///     Save writes the xml respresentation
        ///     for the given object instance to the given stream
        /// </summary>
        /// <param name="obj">
        ///     Object instance
        /// </param>
        /// <param name="stream">
        ///     Stream
        /// </param>
        /// <remarks>
        ///     This API requires unmanaged code permission
        /// </remarks>
        public static void Save(object obj, Stream stream)
        {
            // Validate input arguments
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            // Create XmlTextWriter
            XmlTextWriter xmlWriter = new XmlTextWriter(stream, null);

            MarkupWriter.SaveAsXml(xmlWriter, obj);
        }
Esempio n. 7
0
        /// <summary>
        ///     Save writes the xml respresentation
        ///     for the given object instance using the given writer
        /// </summary>
        /// <param name="obj">
        ///     Object instance
        /// </param>
        /// <param name="writer">
        ///     Text Writer
        /// </param>
        /// <remarks>
        ///     This API requires unmanaged code permission
        /// </remarks>
        public static void Save(object obj, TextWriter writer)
        {
            // Must be in full trust
            SecurityHelper.DemandUnmanagedCode();

            // Validate input arguments
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            // Create XmlTextWriter
            XmlTextWriter xmlWriter = new XmlTextWriter(writer);

            MarkupWriter.SaveAsXml(xmlWriter, obj);
        }
Esempio n. 8
0
 public static void Save(object obj, XmlWriter xmlWriter)
 {
     SecurityHelper.DemandUnmanagedCode();
     if (obj == null)
     {
         throw new ArgumentNullException("obj");
     }
     if (xmlWriter == null)
     {
         throw new ArgumentNullException("xmlWriter");
     }
     try
     {
         MarkupWriter.SaveAsXml(xmlWriter, obj);
     }
     finally
     {
         xmlWriter.Flush();
     }
 }
Esempio n. 9
0
        /// <summary>
        ///     Save writes the xml respresentation
        ///     for the given object instance using the given
        ///     writer. In addition it also allows the designer
        ///     to participate in this conversion.
        /// </summary>
        /// <param name="obj">
        ///     Object instance
        /// </param>
        /// <param name="xmlWriter">
        ///     XmlWriter
        /// </param>
        /// <remarks>
        ///     This API requires unmanaged code permission
        /// </remarks>
        public static void Save(object obj, XmlWriter xmlWriter)
        {
            // Validate input arguments
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            if (xmlWriter == null)
            {
                throw new ArgumentNullException("xmlWriter");
            }

            try
            {
                MarkupWriter.SaveAsXml(xmlWriter, obj);
            }
            finally
            {
                xmlWriter.Flush();
            }
        }