Exemple #1
0
        /// <summary>
        /// Determines the level of this message, when taking into account warning-as-error,
        /// warning level, verbosity level and message suppressed by the caller.
        /// </summary>
        /// <param name="mea">Event arguments for the message.</param>
        /// <returns>MessageLevel representing the level of this message.</returns>
        protected MessageLevel CalculateMessageLevel(MessageEventArgs mea)
        {
            if (null == mea)
            {
                throw new ArgumentNullException("mea");
            }

            MessageLevel messageLevel = MessageLevel.Nothing;

            if (mea is WixVerbose)
            {
                if (mea.Level >= (int)this.verbosityLevel)
                {
                    messageLevel = MessageLevel.Information;
                }
            }
            else if (mea is WixWarning)
            {
                if (this.suppressedWarnings.ContainsKey(mea.Id))
                {
                    return(MessageLevel.Nothing);
                }

                if (mea.Level >= (int)this.warningLevel)
                {
                    if (this.warningAsError)
                    {
                        this.lastErrorNumber = mea.Id;
                        messageLevel         = MessageLevel.Error;
                    }
                    else
                    {
                        messageLevel = MessageLevel.Warning;
                    }
                }
            }
            else if (mea is WixError)
            {
                this.lastErrorNumber = mea.Id;
                if ((int)ErrorLevel.Fatal == mea.Level)
                {
                    messageLevel = MessageLevel.FatalError;
                }
                else
                {
                    messageLevel = MessageLevel.Error;
                }
            }
            else
            {
                Debug.Assert(false, String.Format("Unknown MessageEventArgs type: {0}.", mea.GetType().ToString()));
            }

            return(messageLevel);
        }
Exemple #2
0
        /// <summary>
        /// Determines the level of this message, when taking into account warning-as-error,
        /// warning level, verbosity level and message suppressed by the caller.
        /// </summary>
        /// <param name="mea">Event arguments for the message.</param>
        /// <returns>MessageLevel representing the level of this message.</returns>
        protected MessageLevel CalculateMessageLevel(MessageEventArgs mea)
        {
            if (null == mea)
            {
                throw new ArgumentNullException("mea");
            }

            MessageLevel messageLevel = MessageLevel.Nothing;

            if (mea is WixVerboseEventArgs)
            {
                if (this.showVerboseMessages)
                {
                    messageLevel = MessageLevel.Information;
                }
            }
            else if (mea is WixWarningEventArgs)
            {
                if (this.SuppressAllWarnings || this.suppressedWarnings.ContainsKey(mea.Id))
                {
                    messageLevel = MessageLevel.Nothing;
                }
                else if (this.WarningAsError || this.warningsAsErrors.ContainsKey(mea.Id))
                {
                    messageLevel = MessageLevel.Error;
                }
                else
                {
                    messageLevel = MessageLevel.Warning;
                }
            }
            else if (mea is WixErrorEventArgs)
            {
                messageLevel = MessageLevel.Error;
            }
            else if (mea is WixGenericMessageEventArgs)
            {
                messageLevel = mea.Level;
            }
            else
            {
                Debug.Assert(false, String.Format(CultureInfo.InvariantCulture, "Unknown MessageEventArgs type: {0}.", mea.GetType().ToString()));
            }

            mea.Level = messageLevel;
            return(messageLevel);
        }
Exemple #3
0
        /// <summary>
        /// Determines the level of this message, when taking into account warning-as-error, 
        /// warning level, verbosity level and message suppressed by the caller.
        /// </summary>
        /// <param name="mea">Event arguments for the message.</param>
        /// <returns>MessageLevel representing the level of this message.</returns>
        protected MessageLevel CalculateMessageLevel(MessageEventArgs mea)
        {
            if (null == mea)
            {
                throw new ArgumentNullException("mea");
            }

            MessageLevel messageLevel = MessageLevel.Nothing;

            if (mea is WixVerboseEventArgs)
            {
                if (this.showVerboseMessages)
                {
                    messageLevel = MessageLevel.Information;
                }
            }
            else if (mea is WixWarningEventArgs)
            {
                if (this.SuppressAllWarnings || this.suppressedWarnings.ContainsKey(mea.Id))
                {
                    messageLevel = MessageLevel.Nothing;
                }
                else if (this.WarningAsError || this.warningsAsErrors.ContainsKey(mea.Id))
                {
                    messageLevel = MessageLevel.Error;
                }
                else
                {
                    messageLevel = MessageLevel.Warning;
                }
            }
            else if (mea is WixErrorEventArgs)
            {
                messageLevel = MessageLevel.Error;
            }
            else if (mea is WixGenericMessageEventArgs)
            {
                messageLevel = mea.Level;
            }
            else
            {
                Debug.Assert(false, String.Format(CultureInfo.InvariantCulture, "Unknown MessageEventArgs type: {0}.", mea.GetType().ToString()));
            }

            mea.Level = messageLevel;
            return messageLevel;
        }
        /// <summary>
        /// Determines the level of this message, when taking into account warning-as-error,
        /// warning level, verbosity level and message suppressed by the caller.
        /// </summary>
        /// <param name="mea">Event arguments for the message.</param>
        /// <returns>MessageLevel representing the level of this message.</returns>
        protected MessageLevel CalculateMessageLevel(MessageEventArgs mea)
        {
            if (null == mea)
            {
                throw new ArgumentNullException("mea");
            }

            MessageLevel messageLevel = MessageLevel.Nothing;

            if (mea is WixVerbose)
            {
                if (mea.Level >= (int)this.verbosityLevel)
                {
                    messageLevel = MessageLevel.Information;
                }
            }
            else if (mea is WixWarning)
            {
                if (this.suppressedWarnings.ContainsKey(mea.Id))
                {
                    return MessageLevel.Nothing;
                }

                if (mea.Level >= (int)this.warningLevel)
                {
                    if (this.warningAsError)
                    {
                        this.lastErrorNumber = mea.Id;
                        messageLevel = MessageLevel.Error;
                    }
                    else
                    {
                        messageLevel = MessageLevel.Warning;
                    }
                }
            }
            else if (mea is WixError)
            {
                this.lastErrorNumber = mea.Id;
                if ((int)ErrorLevel.Fatal == mea.Level)
                {
                    messageLevel = MessageLevel.FatalError;
                }
                else
                {
                    messageLevel = MessageLevel.Error;
                }
            }
            else
            {
                Debug.Assert(false, String.Format("Unknown MessageEventArgs type: {0}.", mea.GetType().ToString()));
            }

            return messageLevel;
        }