// // Copyright (C) Microsoft. All rights reserved. // using Microsoft.PowerShell.Activities; using System.Management.Automation; using System.Activities; using System.Collections.Generic; using System.ComponentModel; namespace Microsoft.PowerShell.Core.Activities { /// /// Activity to invoke the Microsoft.PowerShell.Core\Get-Command command in a Workflow. /// [System.CodeDom.Compiler.GeneratedCode("Microsoft.PowerShell.Activities.ActivityGenerator.GenerateFromName", "3.0")] public sealed class GetCommand : PSRemotingActivity { /// /// Gets the display name of the command invoked by this activity. /// public GetCommand() { this.DisplayName = "Get-Command"; } /// /// Gets the fully qualified name of the command invoked by this activity. /// public override string PSCommandName { get { return "Microsoft.PowerShell.Core\\Get-Command"; } } // Arguments /// /// Provides access to the Name parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Name { get; set; } /// /// Provides access to the Verb parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Verb { get; set; } /// /// Provides access to the Noun parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Noun { get; set; } /// /// Provides access to the Module parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Module { get; set; } /// /// Provides access to the FullyQualifiedModule parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument FullyQualifiedModule { get; set; } /// /// Provides access to the CommandType parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument CommandType { get; set; } /// /// Provides access to the TotalCount parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument TotalCount { get; set; } /// /// Provides access to the Syntax parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Syntax { get; set; } /// /// Provides access to the ShowCommandInfo parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ShowCommandInfo { get; set; } /// /// Provides access to the ArgumentList parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ArgumentList { get; set; } /// /// Provides access to the All parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument All { get; set; } /// /// Provides access to the ListImported parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ListImported { get; set; } /// /// Provides access to the ParameterName parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ParameterName { get; set; } /// /// Provides access to the ParameterType parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ParameterType { get; set; } // Module defining this command // Optional custom code for this activity /// /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// /// The NativeActivityContext for the currently running activity. /// A populated instance of System.Management.Automation.PowerShell /// The infrastructure takes responsibility for closing and disposing the PowerShell instance returned. protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if(Name.Expression != null) { targetCommand.AddParameter("Name", Name.Get(context)); } if(Verb.Expression != null) { targetCommand.AddParameter("Verb", Verb.Get(context)); } if(Noun.Expression != null) { targetCommand.AddParameter("Noun", Noun.Get(context)); } if(Module.Expression != null) { targetCommand.AddParameter("Module", Module.Get(context)); } if(FullyQualifiedModule.Expression != null) { targetCommand.AddParameter("FullyQualifiedModule", FullyQualifiedModule.Get(context)); } if(CommandType.Expression != null) { targetCommand.AddParameter("CommandType", CommandType.Get(context)); } if(TotalCount.Expression != null) { targetCommand.AddParameter("TotalCount", TotalCount.Get(context)); } if(Syntax.Expression != null) { targetCommand.AddParameter("Syntax", Syntax.Get(context)); } if(ShowCommandInfo.Expression != null) { targetCommand.AddParameter("ShowCommandInfo", ShowCommandInfo.Get(context)); } if(ArgumentList.Expression != null) { targetCommand.AddParameter("ArgumentList", ArgumentList.Get(context)); } if(All.Expression != null) { targetCommand.AddParameter("All", All.Get(context)); } if(ListImported.Expression != null) { targetCommand.AddParameter("ListImported", ListImported.Get(context)); } if(ParameterName.Expression != null) { targetCommand.AddParameter("ParameterName", ParameterName.Get(context)); } if(ParameterType.Expression != null) { targetCommand.AddParameter("ParameterType", ParameterType.Get(context)); } return new ActivityImplementationContext() { PowerShellInstance = invoker }; } } }