//
// 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.Utility.Activities
{
///
/// Activity to invoke the Microsoft.PowerShell.Utility\Select-String command in a Workflow.
///
[System.CodeDom.Compiler.GeneratedCode("Microsoft.PowerShell.Activities.ActivityGenerator.GenerateFromName", "3.0")]
public sealed class SelectString : PSRemotingActivity
{
///
/// Gets the display name of the command invoked by this activity.
///
public SelectString()
{
this.DisplayName = "Select-String";
}
///
/// Gets the fully qualified name of the command invoked by this activity.
///
public override string PSCommandName { get { return "Microsoft.PowerShell.Utility\\Select-String"; } }
// Arguments
///
/// Provides access to the InputObject parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument InputObject { get; set; }
///
/// Provides access to the Pattern parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument Pattern { get; set; }
///
/// Provides access to the Path parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument Path { get; set; }
///
/// Provides access to the LiteralPath parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument LiteralPath { get; set; }
///
/// Provides access to the SimpleMatch parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument SimpleMatch { get; set; }
///
/// Provides access to the CaseSensitive parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument CaseSensitive { get; set; }
///
/// Provides access to the Quiet parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument Quiet { get; set; }
///
/// Provides access to the List parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument List { get; set; }
///
/// Provides access to the Include parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument Include { get; set; }
///
/// Provides access to the Exclude parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument Exclude { get; set; }
///
/// Provides access to the NotMatch parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument NotMatch { get; set; }
///
/// Provides access to the AllMatches parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument AllMatches { get; set; }
///
/// Provides access to the Encoding parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument Encoding { get; set; }
///
/// Provides access to the Context parameter.
///
[ParameterSpecificCategory]
[DefaultValue(null)]
public InArgument Context { 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 Sytem.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(InputObject.Expression != null)
{
targetCommand.AddParameter("InputObject", InputObject.Get(context));
}
if(Pattern.Expression != null)
{
targetCommand.AddParameter("Pattern", Pattern.Get(context));
}
if(Path.Expression != null)
{
targetCommand.AddParameter("Path", Path.Get(context));
}
if(LiteralPath.Expression != null)
{
targetCommand.AddParameter("LiteralPath", LiteralPath.Get(context));
}
if(SimpleMatch.Expression != null)
{
targetCommand.AddParameter("SimpleMatch", SimpleMatch.Get(context));
}
if(CaseSensitive.Expression != null)
{
targetCommand.AddParameter("CaseSensitive", CaseSensitive.Get(context));
}
if(Quiet.Expression != null)
{
targetCommand.AddParameter("Quiet", Quiet.Get(context));
}
if(List.Expression != null)
{
targetCommand.AddParameter("List", List.Get(context));
}
if(Include.Expression != null)
{
targetCommand.AddParameter("Include", Include.Get(context));
}
if(Exclude.Expression != null)
{
targetCommand.AddParameter("Exclude", Exclude.Get(context));
}
if(NotMatch.Expression != null)
{
targetCommand.AddParameter("NotMatch", NotMatch.Get(context));
}
if(AllMatches.Expression != null)
{
targetCommand.AddParameter("AllMatches", AllMatches.Get(context));
}
if(Encoding.Expression != null)
{
targetCommand.AddParameter("Encoding", Encoding.Get(context));
}
if(Context.Expression != null)
{
targetCommand.AddParameter("Context", Context.Get(context));
}
return new ActivityImplementationContext() { PowerShellInstance = invoker };
}
}
}