Windows-powershell / PowerShell-master /src /Microsoft.PowerShell.Commands.Utility /commands /utility /trace /GetTracerCommand.cs
Download PowerShell-master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/GetTracerCommand.cs from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/GetTracerCommand.cs
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/GetTracerCommand.cs
-
curl -L -o GetTracerCommand.cs https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/GetTracerCommand.cs
1.69 kB
| // Copyright (c) Microsoft Corporation. | |
| // Licensed under the MIT License. | |
| using System.Linq; | |
| using System.Management.Automation; | |
| namespace Microsoft.PowerShell.Commands | |
| { | |
| /// <summary> | |
| /// A cmdlet that gets the TraceSource instances that are instantiated in the process. | |
| /// </summary> | |
| [] | |
| [] | |
| public class GetTraceSourceCommand : TraceCommandBase | |
| { | |
| /// <summary> | |
| /// Gets or sets the category parameter which determines which trace switch to get. | |
| /// </summary> | |
| /// <value></value> | |
| [] | |
| [] | |
| public string[] Name | |
| { | |
| get | |
| { | |
| return _names; | |
| } | |
| set | |
| { | |
| if (value == null || value.Length == 0) | |
| { | |
| value = new string[] { "*" }; | |
| } | |
| _names = value; | |
| } | |
| } | |
| private string[] _names = new string[] { "*" }; | |
| /// <summary> | |
| /// Gets the PSTraceSource for the specified category. | |
| /// </summary> | |
| protected override void ProcessRecord() | |
| { | |
| var sources = GetMatchingTraceSource(_names, true); | |
| var result = sources.OrderBy(static source => source.Name); | |
| WriteObject(result, true); | |
| } | |
| } | |
| } | |