aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/WixGenericMessageEventArgs.cs
blob: 2c1d470529c4b2d7cb3d0cd0d22f4b24ee0c3a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.

namespace WixToolset
{
    using System;
    using System.Resources;
    using WixToolset.Data;

    /// <summary>
    /// Generic event args for message events.
    /// </summary>
    public class WixGenericMessageEventArgs : MessageEventArgs
    {
        /// <summary>
        /// Creates a new generc message event arg.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line numbers for the message.</param>
        /// <param name="id">Id for the message.</param>
        /// <param name="level">Level for the message.</param>
        /// <param name="format">Format message for arguments.</param>
        /// <param name="messageArgs">Arguments for the format string.</param>
        public WixGenericMessageEventArgs(SourceLineNumber sourceLineNumbers, int id, MessageLevel level, string format, params object[] messageArgs)
            : base(sourceLineNumbers, id, format, messageArgs)
        {
            base.Level = level;
            base.ResourceManager = new GenericResourceManager();
        }

        /// <summary>
        /// Private resource manager to return our format message as the "localized" string untouched.
        /// </summary>
        private class GenericResourceManager : ResourceManager
        {
            /// <summary>
            /// Passes the "resource name" through as the format string.
            /// </summary>
            /// <param name="name">Format message that is passed in as the resource name.</param>
            /// <returns>The name.</returns>
            public override string GetString(string name)
            {
                return name;
            }
        }
    }
}