private void ProcessCmdletAttribute(CmdletCommonMetadataAttribute attribute) { if (attribute == null) { throw PSTraceSource.NewArgumentNullException("attribute"); } this._defaultParameterSetName = attribute.DefaultParameterSetName; this._supportsShouldProcess = attribute.SupportsShouldProcess; this._confirmImpact = attribute.ConfirmImpact; this._supportsPaging = attribute.SupportsPaging; this._supportsTransactions = attribute.SupportsTransactions; this._helpUri = attribute.HelpUri; this._remotingCapability = attribute.RemotingCapability; CmdletBindingAttribute attribute2 = attribute as CmdletBindingAttribute; if (attribute2 != null) { this.PositionalBinding = attribute2.PositionalBinding; } }
} // ConstructCmdletMetadataUsingReflection /// <summary> /// Extracts the cmdlet data from the CmdletAttribute /// </summary> /// /// <param name="attribute"> /// The CmdletAttribute to process /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="attribute"/> is null. /// </exception> /// /// <exception cref="ParsingMetadataException"> /// If more than int.MaxValue parameter-sets are defined for the command. /// </exception> /// private void ProcessCmdletAttribute(CmdletCommonMetadataAttribute attribute) { if (attribute == null) { throw PSTraceSource.NewArgumentNullException("attribute"); } // Process the default parameter set name _defaultParameterSetName = attribute.DefaultParameterSetName; // Check to see if the cmdlet supports ShouldProcess SupportsShouldProcess = attribute.SupportsShouldProcess; // Determine the cmdlet's impact confirmation ConfirmImpact = attribute.ConfirmImpact; // Check to see if the cmdlet supports paging SupportsPaging = attribute.SupportsPaging; // Check to see if the cmdlet supports transactions SupportsTransactions = attribute.SupportsTransactions; // Grab related link HelpUri = attribute.HelpUri; // Remoting support _remotingCapability = attribute.RemotingCapability; // Check to see if the cmdlet uses positional binding var cmdletBindingAttribute = attribute as CmdletBindingAttribute; if (cmdletBindingAttribute != null) { PositionalBinding = cmdletBindingAttribute.PositionalBinding; } } // ProcessCmdletAttribute