main
cs 79 lines 2.84 KB
Raw
1 // 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.
2
3 namespace WixToolset.Extensibility.Services
4 {
5 using WixToolset.Data;
6
7 /// <summary>
8 /// Interface for handling messages (error/warning/verbose).
9 /// </summary>
10 public interface IMessaging
11 {
12 /// <summary>
13 /// Indicates whether an error has been found.
14 /// </summary>
15 /// <value>A bool indicating whether an error has been found.</value>
16 bool EncounteredError { get; }
17
18 /// <summary>
19 /// Gets the number of errors encountered thus far.
20 /// </summary>
21 /// <value>The number of errors encountered.</value>
22 int ErrorCount { get; }
23
24 /// <summary>
25 /// Gets the last error code encountered during messaging.
26 /// </summary>
27 /// <value>The exit code for the process.</value>
28 int LastErrorNumber { get; }
29
30 /// <summary>
31 /// Gets or sets the option to show verbose messages.
32 /// </summary>
33 /// <value>The option to show verbose messages.</value>
34 bool ShowVerboseMessages { get; set; }
35
36 /// <summary>
37 /// Gets or sets the option to suppress all warning messages.
38 /// </summary>
39 /// <value>The option to suppress all warning messages.</value>
40 bool SuppressAllWarnings { get; set; }
41
42 /// <summary>
43 /// Gets and sets the option to treat warnings as errors.
44 /// </summary>
45 /// <value>The option to treat warnings as errors.</value>
46 bool WarningsAsError { get; set; }
47
48 /// <summary>
49 /// Sets the listener for messaging.
50 /// </summary>
51 /// <param name="listener"></param>
52 void SetListener(IMessageListener listener);
53
54 /// <summary>
55 /// Adds a warning message id to be elevated to an error message.
56 /// </summary>
57 /// <param name="warningNumber">Id of the message to elevate.</param>
58 void ElevateWarningMessage(int warningNumber);
59
60 /// <summary>
61 /// Adds a warning message id to be suppressed in message output.
62 /// </summary>
63 /// <param name="warningNumber">Id of the message to suppress.</param>
64 void SuppressWarningMessage(int warningNumber);
65
66 /// <summary>
67 /// Sends a message with the given arguments.
68 /// </summary>
69 /// <param name="message">Message to write.</param>
70 void Write(Message message);
71
72 /// <summary>
73 /// Sends a message with the given arguments.
74 /// </summary>
75 /// <param name="message">Message to write.</param>
76 /// <param name="verbose">Indicates where to write a verbose message.</param>
77 void Write(string message, bool verbose = false);
78 }
79 }