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