Example #1
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>
        internal 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);
        }
Example #2
0
 /// <summary>
 /// Gets a Windows Installer error message in the system default language.
 /// </summary>
 /// <param name="errorNumber">The error number.</param>
 /// <returns>The message string, or null if the error message is not found.</returns>
 /// <remarks><p>
 /// The returned string may have tokens such as [2] and [3] that are meant to be substituted
 /// with context-specific values.
 /// </p><p>
 /// Error numbers greater than 2000 refer to MSI "internal" errors, and are always
 /// returned in English.
 /// </p></remarks>
 internal static string GetErrorMessage(int errorNumber)
 {
     return(Installer.GetErrorMessage(errorNumber, null));
 }
Example #3
0
 /// <summary>
 /// Gets a formatted Windows Installer error message in the system default language.
 /// </summary>
 /// <param name="errorRecord">Error record containing the error number in the first field, and
 /// error-specific parameters in the other fields.</param>
 /// <returns>The message string, or null if the error message is not found.</returns>
 /// <remarks><p>
 /// Error numbers greater than 2000 refer to MSI "internal" errors, and are always
 /// returned in English.
 /// </p></remarks>
 internal static string GetErrorMessage(Record errorRecord)
 {
     return(Installer.GetErrorMessage(errorRecord, null));
 }