// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #region Using directives using System; using Microsoft.Management.Infrastructure.Options; #endregion namespace Microsoft.Management.Infrastructure.CimCmdlets { /// /// /// Write message to message channel /// /// internal sealed class CimWriteMessage : CimBaseAction { #region members /// /// Channel id. /// private UInt32 channel; /// /// Message to write to the channel. /// private string message; #endregion #region Properties internal UInt32 Channel { get { return channel; } } internal string Message { get { return message; } } #endregion /// /// Constructor method. /// public CimWriteMessage(UInt32 channel, string message) { this.channel = channel; this.message = message; } /// /// /// Write message to the target channel /// /// /// public override void Execute(CmdletOperationBase cmdlet) { ValidationHelper.ValidateNoNullArgument(cmdlet, "cmdlet"); switch ((CimWriteMessageChannel)channel) { case CimWriteMessageChannel.Verbose: cmdlet.WriteVerbose(message); break; case CimWriteMessageChannel.Warning: cmdlet.WriteWarning(message); break; case CimWriteMessageChannel.Debug: cmdlet.WriteDebug(message); break; default: break; } } } }