XamlTemplateSerializer.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Markup / XamlTemplateSerializer.cs / 1 / XamlTemplateSerializer.cs

                            //---------------------------------------------------------------------------- 
//
// File: XamlTemplateSerializer.cs
//
// Description: 
//   Class that serializes and deserializes Templates.
// 
// Copyright (C) 2004 by Microsoft Corporation.  All rights reserved. 
//
//--------------------------------------------------------------------------- 

using System;
using System.ComponentModel;
 
using System.ComponentModel.Design.Serialization;
using System.Diagnostics; 
using System.Collections; 
using System.Globalization;
using System.IO; 
using System.Reflection;
using System.Text;
using System.Xml;
using System.Security.Permissions; 
using MS.Utility;
 
#if !PBTCOMPILER 
using System.Windows.Data;
using System.Windows.Controls; 
using System.Windows.Documents;
#endif

#if PBTCOMPILER 
namespace MS.Internal.Markup
#else 
namespace System.Windows.Markup 
#endif
{ 
    /// 
    ///     Class that knows how to serialize and deserialize Template objects
    /// 
    internal class XamlTemplateSerializer : XamlSerializer 
    {
        #region Construction 
 
        /// 
        ///     Constructor for XamlTemplateSerializer 
        /// 
        public XamlTemplateSerializer() : base()
        {
        } 

 
        internal XamlTemplateSerializer(ParserHooks parserHooks) : base() 
        {
            _parserHooks = parserHooks; 
        }

        #endregion Construction
 
        #region OtherConversions
 
        ///  
        ///   Convert from Xaml read by a token reader into baml being written
        ///   out by a record writer.  The context gives mapping information. 
        /// 
#if !PBTCOMPILER
        //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
#endif 
        internal override void ConvertXamlToBaml (
            XamlReaderHelper             tokenReader, 
            ParserContext          context, 
            XamlNode               xamlNode,
            BamlRecordWriter       bamlWriter) 
        {

            TemplateXamlParser templateParser = new TemplateXamlParser(tokenReader, context);
            templateParser.ParserHooks = _parserHooks; 
            templateParser.BamlRecordWriter = bamlWriter;
 
            // Process the xamlNode that is passed in so that the