示例#1
0
        /// <summary>
        /// Writes Iconv legacy options and their values to XML text stream.
        /// Skips options whose values are the same as default values of Phalanger.
        /// </summary>
        /// <param name="writer">XML writer.</param>
        /// <param name="options">A hashtable containing PHP names and option values. Consumed options are removed from the table.</param>
        /// <param name="writePhpNames">Whether to add "phpName" attribute to option nodes.</param>
        public static void LegacyOptionsToIconv(XmlTextWriter writer, Hashtable options, bool writePhpNames)         // GENERICS:<string,string>
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            var local  = new IconvLocalConfig();
            var global = new IconvGlobalConfig();
            var ow     = new PhpIniXmlWriter(writer, options, writePhpNames);

            ow.StartSection("iconv");

            // local:
            ow.WriteOption("iconv.input_encoding", "InputEncoding", "ISO-8859-1", local.InputEncoding);
            ow.WriteOption("iconv.internal_encoding", "InternalEncoding", "ISO-8859-1", local.InternalEncoding);
            ow.WriteOption("iconv.output_encoding", "OutputEncoding", "ISO-8859-1", local.OutputEncoding);

            //// global:
            //ow.WriteOption("mssql.max_links", "MaxConnections", -1, global.MaxConnections);
            //ow.WriteOption("mssql.secure_connection", "NTAuthentication", false, global.NTAuthentication);

            ow.WriteEnd();
        }
示例#2
0
        /// <summary>
        /// Gets, sets, or restores a value of a legacy configuration option.
        /// </summary>
        private static object GetSetRestore(LocalConfiguration config, string option, object value, IniAction action)
        {
            IconvLocalConfig  local    = (IconvLocalConfig)config.GetLibraryConfig(IconvLibraryDescriptor.Singleton);
            IconvLocalConfig  @default = DefaultLocal;
            IconvGlobalConfig global   = Global;

            //[iconv]
            //;iconv.input_encoding = ISO-8859-1
            //;iconv.internal_encoding = ISO-8859-1
            //;iconv.output_encoding = ISO-8859-1

            switch (option)
            {
            //// local:

            case "iconv.input_encoding":
                return(PhpIni.GSR(ref local.InputEncoding, @default.InputEncoding, value, action));

            case "iconv.internal_encoding":
                return(PhpIni.GSR(ref local.InternalEncoding, @default.InternalEncoding, value, action));

            case "iconv.output_encoding":
                return(PhpIni.GSR(ref local.OutputEncoding, @default.OutputEncoding, value, action));
            }

            Debug.Fail("Option '" + option + "' is supported but not implemented.");
            return(null);
        }
示例#3
0
		/// <summary>
        /// Writes Iconv legacy options and their values to XML text stream.
		/// Skips options whose values are the same as default values of Phalanger.
		/// </summary>
		/// <param name="writer">XML writer.</param>
		/// <param name="options">A hashtable containing PHP names and option values. Consumed options are removed from the table.</param>
		/// <param name="writePhpNames">Whether to add "phpName" attribute to option nodes.</param>
		public static void LegacyOptionsToIconv(XmlTextWriter writer, Hashtable options, bool writePhpNames) // GENERICS:<string,string>
		{
			if (writer == null)
				throw new ArgumentNullException("writer");
			if (options == null)
				throw new ArgumentNullException("options");

            var local = new IconvLocalConfig();
			var global = new IconvGlobalConfig();
			var ow = new PhpIniXmlWriter(writer, options, writePhpNames);

            ow.StartSection("iconv");

            // local:
            ow.WriteOption("iconv.input_encoding", "InputEncoding", "ISO-8859-1", local.InputEncoding);
            ow.WriteOption("iconv.internal_encoding", "InternalEncoding", "ISO-8859-1", local.InternalEncoding);
            ow.WriteOption("iconv.output_encoding", "OutputEncoding", "ISO-8859-1", local.OutputEncoding);

            //// global:
            //ow.WriteOption("mssql.max_links", "MaxConnections", -1, global.MaxConnections);
            //ow.WriteOption("mssql.secure_connection", "NTAuthentication", false, global.NTAuthentication);

			ow.WriteEnd();
		}