From 46a4f1d98fdedc82c701ada198252dfd6099959f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 19 Dec 2017 12:24:49 -0800 Subject: Integrate simplified message handling --- .../Services/IBindContext.cs | 2 +- .../Services/ICommandLineContext.cs | 3 +- .../Services/ILinkContext.cs | 2 +- .../Services/IMessaging.cs | 80 ++++++++++++++++++++++ 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 src/WixToolset.Extensibility/Services/IMessaging.cs (limited to 'src/WixToolset.Extensibility/Services') diff --git a/src/WixToolset.Extensibility/Services/IBindContext.cs b/src/WixToolset.Extensibility/Services/IBindContext.cs index 6bed0ef6..ad1aa818 100644 --- a/src/WixToolset.Extensibility/Services/IBindContext.cs +++ b/src/WixToolset.Extensibility/Services/IBindContext.cs @@ -10,7 +10,7 @@ namespace WixToolset.Extensibility.Services { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } IEnumerable BindPaths { get; set; } diff --git a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs index 0e040d7f..27d4e6dd 100644 --- a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs +++ b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs @@ -3,13 +3,12 @@ namespace WixToolset.Extensibility.Services { using System; - using WixToolset.Data; public interface ICommandLineContext { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } IExtensionManager ExtensionManager { get; set; } diff --git a/src/WixToolset.Extensibility/Services/ILinkContext.cs b/src/WixToolset.Extensibility/Services/ILinkContext.cs index 25c7962f..e098a900 100644 --- a/src/WixToolset.Extensibility/Services/ILinkContext.cs +++ b/src/WixToolset.Extensibility/Services/ILinkContext.cs @@ -10,7 +10,7 @@ namespace WixToolset.Extensibility.Services { IServiceProvider ServiceProvider { get; } - Messaging Messaging { get; set; } + IMessaging Messaging { get; set; } IEnumerable Extensions { get; set; } diff --git a/src/WixToolset.Extensibility/Services/IMessaging.cs b/src/WixToolset.Extensibility/Services/IMessaging.cs new file mode 100644 index 00000000..901c7af4 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IMessaging.cs @@ -0,0 +1,80 @@ +// 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.Extensibility.Services +{ + using WixToolset.Data; + + /// + /// Interface for handling messages (error/warning/verbose). + /// + public interface IMessaging + { + /// + /// Indicates whether an error has been found. + /// + /// A bool indicating whether an error has been found. + bool EncounteredError { get; } + + /// + /// Gets the last error code encountered during messaging. + /// + /// The exit code for the process. + int LastErrorNumber { get; } + + /// + /// Gets or sets the option to show verbose messages. + /// + /// The option to show verbose messages. + bool ShowVerboseMessages { get; set; } + + /// + /// Gets or sets the option to suppress all warning messages. + /// + /// The option to suppress all warning messages. + bool SuppressAllWarnings { get; set; } + + /// + /// Gets and sets the option to treat warnings as errors. + /// + /// The option to treat warnings as errors. + bool WarningsAsError { get; set; } + + /// + /// Sets the listener for messaging. + /// + /// + void SetListener(IMessageListener listener); + + /// + /// Adds a warning message id to be elevated to an error message. + /// + /// Id of the message to elevate. + void ElevateWarningMessage(int warningNumber); + + /// + /// Adds a warning message id to be suppressed in message output. + /// + /// Id of the message to suppress. + void SuppressWarningMessage(int warningNumber); + + /// + /// Formats a message to standard message. + /// + /// Message to format. + /// Formatted message + string FormatMessage(Message message); + + /// + /// Sends a message with the given arguments. + /// + /// Message to write. + void Write(Message message); + + /// + /// Sends a message with the given arguments. + /// + /// Message to write. + /// Indicates where to write a verbose message. + void Write(string message, bool verbose = false); + } +} -- cgit v1.2.3-55-g6feb