Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4#region Using directives5 6using System;7using Microsoft.Management.Infrastructure.Options;8 9#endregion10 11namespace Microsoft.Management.Infrastructure.CimCmdlets12{13    /// <summary>14    /// <para>15    /// Write message to message channel16    /// </para>17    /// </summary>18    internal sealed class CimWriteMessage : CimBaseAction19    {20        #region members21 22        /// <summary>23        /// Channel id.24        /// </summary>25        #endregion26 27        #region Properties28 29        internal uint Channel { get; }30 31        internal string Message { get; }32 33        #endregion34 35        /// <summary>36        /// Initializes a new instance of the <see cref="CimWriteMessage"/> class.37        /// </summary>38        public CimWriteMessage(uint channel,39            string message)40        {41            this.Channel = channel;42            this.Message = message;43        }44 45        /// <summary>46        /// <para>47        /// Write message to the target channel48        /// </para>49        /// </summary>50        /// <param name="cmdlet"></param>51        public override void Execute(CmdletOperationBase cmdlet)52        {53            ValidationHelper.ValidateNoNullArgument(cmdlet, "cmdlet");54 55            switch ((CimWriteMessageChannel)Channel)56            {57                case CimWriteMessageChannel.Verbose:58                    cmdlet.WriteVerbose(Message);59                    break;60                case CimWriteMessageChannel.Warning:61                    cmdlet.WriteWarning(Message);62                    break;63                case CimWriteMessageChannel.Debug:64                    cmdlet.WriteDebug(Message);65                    break;66                default:67                    break;68            }69        }70    }71}72