File size: 6,695 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace System.Management.Automation
{
/// <summary>
/// Provides information about a configuration that is stored in session state.
/// </summary>
public class ConfigurationInfo : FunctionInfo
{
#region ctor
/// <summary>
/// Creates an instance of the ConfigurationInfo class with the specified name and ScriptBlock.
/// </summary>
/// <param name="name">
/// The name of the configuration.
/// </param>
/// <param name="configuration">
/// The ScriptBlock for the configuration
/// </param>
/// <param name="context">
/// The ExecutionContext for the configuration.
/// </param>
/// <exception cref="ArgumentNullException">
/// If <paramref name="configuration"/> is null.
/// </exception>
internal ConfigurationInfo(string name, ScriptBlock configuration, ExecutionContext context) : this(name, configuration, context, null)
{
}
/// <summary>
/// Creates an instance of the ConfigurationInfo class with the specified name and ScriptBlock.
/// </summary>
/// <param name="name">
/// The name of the configuration.
/// </param>
/// <param name="configuration">
/// The ScriptBlock for the configuration
/// </param>
/// <param name="context">
/// The ExecutionContext for the configuration.
/// </param>
/// <param name="helpFile">
/// The help file for the configuration.
/// </param>
/// <exception cref="ArgumentNullException">
/// If <paramref name="configuration"/> is null.
/// </exception>
internal ConfigurationInfo(string name, ScriptBlock configuration, ExecutionContext context, string helpFile)
: base(name, configuration, context, helpFile)
{
SetCommandType(CommandTypes.Configuration);
}
/// <summary>
/// Creates an instance of the ConfigurationInfo class with the specified name and ScriptBlock.
/// </summary>
/// <param name="name">
/// The name of the configuration.
/// </param>
/// <param name="configuration">
/// The ScriptBlock for the configuration
/// </param>
/// <param name="options">
/// The options to set on the function. Note, Constant can only be set at creation time.
/// </param>
/// <param name="context">
/// The execution context for the configuration.
/// </param>
/// <exception cref="ArgumentNullException">
/// If <paramref name="configuration"/> is null.
/// </exception>
internal ConfigurationInfo(string name, ScriptBlock configuration, ScopedItemOptions options, ExecutionContext context) : this(name, configuration, options, context, null)
{
}
/// <summary>
/// Creates an instance of the ConfigurationInfo class with the specified name and ScriptBlock.
/// </summary>
/// <param name="name">
/// The name of the configuration.
/// </param>
/// <param name="configuration">
/// The ScriptBlock for the configuration
/// </param>
/// <param name="options">
/// The options to set on the function. Note, Constant can only be set at creation time.
/// </param>
/// <param name="context">
/// The execution context for the configuration.
/// </param>
/// <param name="helpFile">
/// The help file for the configuration.
/// </param>
/// <param name="isMetaConfig">The configuration is a meta configuration.</param>
/// <exception cref="ArgumentNullException">
/// If <paramref name="configuration"/> is null.
/// </exception>
internal ConfigurationInfo(string name, ScriptBlock configuration, ScopedItemOptions options, ExecutionContext context, string helpFile, bool isMetaConfig)
: base(name, configuration, options, context, helpFile)
{
SetCommandType(CommandTypes.Configuration);
IsMetaConfiguration = isMetaConfig;
}
/// <summary>
/// Creates an instance of the ConfigurationInfo class with the specified name and ScriptBlock.
/// </summary>
/// <param name="name">
/// The name of the configuration.
/// </param>
/// <param name="configuration">
/// The ScriptBlock for the configuration
/// </param>
/// <param name="options">
/// The options to set on the function. Note, Constant can only be set at creation time.
/// </param>
/// <param name="context">
/// The execution context for the configuration.
/// </param>
/// <param name="helpFile">
/// The help file for the configuration.
/// </param>
/// <exception cref="ArgumentNullException">
/// If <paramref name="configuration"/> is null.
/// </exception>
internal ConfigurationInfo(string name, ScriptBlock configuration, ScopedItemOptions options, ExecutionContext context, string helpFile)
: this(name, configuration, options, context, helpFile, false)
{
}
/// <summary>
/// This is a copy constructor, used primarily for get-command.
/// </summary>
internal ConfigurationInfo(ConfigurationInfo other)
: base(other)
{
}
/// <summary>
/// This is a copy constructor, used primarily for get-command.
/// </summary>
internal ConfigurationInfo(string name, ConfigurationInfo other)
: base(name, other)
{
}
/// <summary>
/// Create a copy of commandInfo for GetCommandCommand so that we can generate parameter
/// sets based on an argument list (so we can get the dynamic parameters.)
/// </summary>
internal override CommandInfo CreateGetCommandCopy(object[] arguments)
{
var copy = new ConfigurationInfo(this) { IsGetCommandCopy = true, Arguments = arguments };
return copy;
}
#endregion ctor
internal override HelpCategory HelpCategory
{
get { return HelpCategory.Configuration; }
}
/// <summary>
/// Indication whether the configuration is a meta-configuration.
/// </summary>
public bool IsMetaConfiguration
{ get; internal set; }
}
}
|