public object Create (object parent, object configContext, XmlNode section)
		{
			GlobalizationConfiguration config = new GlobalizationConfiguration (parent);

			if (section.HasChildNodes)
				ThrowException ("No child nodes allowed here.", section);

			string attvalue = AttValue ("requestEncoding", section, true);
			if (attvalue != null)
				config.RequestEncoding = GetEncoding (section, "requestEncoding", attvalue);

			attvalue = AttValue ("responseEncoding", section, true);
			if (attvalue != null)
				config.ResponseEncoding = GetEncoding (section, "responseEncoding", attvalue);

			attvalue = AttValue ("fileEncoding", section, true);
			if (attvalue != null)
				config.FileEncoding = GetEncoding (section, "fileEncoding", attvalue);

			attvalue = AttValue ("culture", section, true);
			if (attvalue != null)
				config.Culture = GetCulture (section, "culture", attvalue);

			attvalue = AttValue ("uiCulture", section, true);
			if (attvalue != null)
				config.UICulture = GetCulture (section, "uiCulture", attvalue);

			if (section.Attributes == null || section.Attributes.Count != 0)
				ThrowException ("Unknown attribute(s).", section);

			return config;
		}
Exemplo n.º 2
0
        internal GlobalizationConfiguration(object p)
        {
            if (!(p is GlobalizationConfiguration))
            {
                return;
            }

            GlobalizationConfiguration parent = (GlobalizationConfiguration)p;

            RequestEncoding  = parent.RequestEncoding;
            ResponseEncoding = parent.ResponseEncoding;
            FileEncoding     = parent.FileEncoding;
            Culture          = parent.Culture;
            UICulture        = parent.UICulture;
        }
        public object Create(object parent, object configContext, XmlNode section)
        {
            GlobalizationConfiguration config = new GlobalizationConfiguration(parent);

            if (section.HasChildNodes)
            {
                ThrowException("No child nodes allowed here.", section);
            }

            string attvalue = AttValue("requestEncoding", section, true);

            if (attvalue != null)
            {
                config.RequestEncoding = GetEncoding(section, "requestEncoding", attvalue);
            }

            attvalue = AttValue("responseEncoding", section, true);
            if (attvalue != null)
            {
                config.ResponseEncoding = GetEncoding(section, "responseEncoding", attvalue);
            }

            attvalue = AttValue("fileEncoding", section, true);
            if (attvalue != null)
            {
                config.FileEncoding = GetEncoding(section, "fileEncoding", attvalue);
            }

            attvalue = AttValue("culture", section, true);
            if (attvalue != null)
            {
                config.Culture = GetCulture(section, "culture", attvalue);
            }

            attvalue = AttValue("uiCulture", section, true);
            if (attvalue != null)
            {
                config.UICulture = GetCulture(section, "uiCulture", attvalue);
            }

            if (section.Attributes == null || section.Attributes.Count != 0)
            {
                ThrowException("Unknown attribute(s).", section);
            }

            return(config);
        }