mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
This reverts the `if !CORECLR ... #endif` guard surrounding FullCLR files by applying the original diff from the `source-depot` branch, thus the accidentally overwritten BOMs were restored as well.
77 lines
2.8 KiB
C#
77 lines
2.8 KiB
C#
//-----------------------------------------------------------------------
|
|
// <copyright file="ShowCommandParameterSetInfo.cs" company="Microsoft">
|
|
// Copyright © Microsoft Corporation. All rights reserved.
|
|
// </copyright>
|
|
//-----------------------------------------------------------------------
|
|
namespace Microsoft.PowerShell.Commands.ShowCommandExtension
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Management.Automation;
|
|
|
|
|
|
/// <summary>
|
|
/// Implements a facade around CommandParameterSetInfo and its deserialized counterpart
|
|
/// </summary>
|
|
public class ShowCommandParameterSetInfo
|
|
{
|
|
/// <summary>
|
|
/// Creates an instance of the ShowCommandParameterSetInfo class based on a CommandParameterSetInfo object
|
|
/// </summary>
|
|
///
|
|
/// <param name="other">
|
|
/// The object to wrap.
|
|
/// </param>
|
|
public ShowCommandParameterSetInfo(CommandParameterSetInfo other)
|
|
{
|
|
if (null == other)
|
|
{
|
|
throw new ArgumentNullException("other");
|
|
}
|
|
|
|
this.Name = other.Name;
|
|
this.IsDefault = other.IsDefault;
|
|
this.Parameters = other.Parameters.Select(x=>new ShowCommandParameterInfo(x)).ToArray();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates an instance of the ShowCommandParameterSetInfo class based on a PSObject object
|
|
/// </summary>
|
|
///
|
|
/// <param name="other">
|
|
/// The object to wrap.
|
|
/// </param>
|
|
public ShowCommandParameterSetInfo(PSObject other)
|
|
{
|
|
if (null == other)
|
|
{
|
|
throw new ArgumentNullException("other");
|
|
}
|
|
|
|
this.Name = other.Members["Name"].Value as string;
|
|
this.IsDefault = (bool)(other.Members["IsDefault"].Value);
|
|
var parameters = (other.Members["Parameters"].Value as PSObject).BaseObject as System.Collections.ArrayList;
|
|
this.Parameters = ShowCommandCommandInfo.GetObjectEnumerable(parameters).Cast<PSObject>().Select(x=>new ShowCommandParameterInfo(x)).ToArray();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the name of the parameter set
|
|
/// </summary>
|
|
public string Name { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets whether the parameter set is the default parameter set.
|
|
/// </summary>
|
|
public bool IsDefault { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets the parameter information for the parameters in this parameter set.
|
|
/// </summary>
|
|
public ICollection<ShowCommandParameterInfo> Parameters { get; private set; }
|
|
}
|
|
} |