Ejemplo n.º 1
0
        public string FormatRecord(Record record, string format)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }

            return(record.ToString(format, this));
        }
Ejemplo n.º 2
0
        public string Format(string format)
        {
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }

            using (Record formatRec = new Record(0))
            {
                formatRec.FormatString = format;
                return(formatRec.ToString(this));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets a formatted Windows Installer error message in a specified language.
        /// </summary>
        /// <param name="errorRecord">Error record containing the error number in the first field, and
        /// error-specific parameters in the other fields.</param>
        /// <param name="culture">The locale for the message.</param>
        /// <returns>The message string, or null if the error message or locale is not found.</returns>
        /// <remarks><p>
        /// Error numbers greater than 2000 refer to MSI "internal" errors, and are always
        /// returned in English.
        /// </p></remarks>
        public static string GetErrorMessage(Record errorRecord, CultureInfo culture)
        {
            if (errorRecord == null)
            {
                throw new ArgumentNullException("errorRecord");
            }
            int errorNumber;

            if (errorRecord.FieldCount < 1 || (errorNumber = (int)errorRecord.GetInteger(1)) == 0)
            {
                throw new ArgumentOutOfRangeException("errorRecord");
            }

            string msg = Installer.GetErrorMessage(errorNumber, culture);

            if (msg != null)
            {
                errorRecord.FormatString = msg;
                msg = errorRecord.ToString((IFormatProvider)null);
            }
            return(msg);
        }
Ejemplo n.º 4
0
        public string FormatRecord(Record record, string format)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }

            return record.ToString(format, this);
        }
Ejemplo n.º 5
0
        public string Format(string format)
        {
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }

            using (Record formatRec = new Record(0))
            {
                formatRec.FormatString = format;
                return formatRec.ToString(this);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets a formatted Windows Installer error message in a specified language.
        /// </summary>
        /// <param name="errorRecord">Error record containing the error number in the first field, and
        /// error-specific parameters in the other fields.</param>
        /// <param name="culture">The locale for the message.</param>
        /// <returns>The message string, or null if the error message or locale is not found.</returns>
        /// <remarks><p>
        /// Error numbers greater than 2000 refer to MSI "internal" errors, and are always
        /// returned in English.
        /// </p></remarks>
        public static string GetErrorMessage(Record errorRecord, CultureInfo culture)
        {
            if (errorRecord == null)
            {
                throw new ArgumentNullException("errorRecord");
            }
            int errorNumber;
            if (errorRecord.FieldCount < 1 || (errorNumber = (int) errorRecord.GetInteger(1)) == 0)
            {
                throw new ArgumentOutOfRangeException("errorRecord");
            }

            string msg = Installer.GetErrorMessage(errorNumber, culture);
            if (msg != null)
            {
                errorRecord.FormatString = msg;
                msg = errorRecord.ToString((IFormatProvider)null);
            }
            return msg;
        }