Ejemplo n.º 1
0
        /// <summary>
        /// Implements the begin action of the command
        /// </summary>
        protected override void BeginProcessing()
        {
            object outBuffer;

            if (MyInvocation.BoundParameters.TryGetValue("OutBuffer", out outBuffer))
            {
                MyInvocation.BoundParameters["OutBuffer"] = 1;
            }

            Hashtable clonedBoundParameters = new Hashtable();

            foreach (string key in MyInvocation.BoundParameters.Keys)
            {
                if (!_NonclonedProperties.Contains(key))
                {
                    clonedBoundParameters[key] = MyInvocation.BoundParameters[key];
                }
            }

            if (MyInvocation.BoundParameters.ContainsKey("Property"))
            {
                clonedBoundParameters["Property"] = Property.Select(o => o.Value).AsEnumerable().ToArray();
            }

            if ((ShowExcludeProperty.Length > 0) || (ShowProperty.Length > 0) || (!String.IsNullOrEmpty(TypeName)) || (KeepInputObject.ToBool()))
            {
                _NoAdjustment = false;
            }

            if (ShowProperty.Length > 0)
            {
                _DisplayPropertySet = new PSMemberInfo[] { new PSPropertySet("DefaultDisplayPropertySet", ShowProperty) }
            }
            ;

            // Set the list of parameters to a variable in the caller scope, so it can be splatted
            this.SessionState.PSVariable.Set("__PSFramework_SelectParam", clonedBoundParameters);
            ScriptBlock scriptCommand = ScriptBlock.Create("Select-Object @__PSFramework_SelectParam");

            _Pipeline = scriptCommand.GetSteppablePipeline(MyInvocation.CommandOrigin);

            if (_NoAdjustment)
            {
                _Pipeline.Begin(this);
            }
            else
            {
                _Pipeline.Begin(true);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Override BeginProcessing.
 /// </summary>
 protected override void BeginProcessing()
 {
     if (!UseBrowser.IsPresent)
     {
         // Since UseBrowser is not bound, we use proxy to Out-Default
         stepPipe = ScriptBlock.Create(@"Microsoft.PowerShell.Core\Out-Default @PSBoundParameters").GetSteppablePipeline(this.MyInvocation.CommandOrigin);
         stepPipe.Begin(this);
     }
 }
 /// <summary>
 /// BeginProcessing override.
 /// </summary>
 protected override void BeginProcessing()
 {
     _stepPipeline = s_pwsh.GetSteppablePipeline();
     _stepPipeline.Begin(this);
 }
Ejemplo n.º 4
0
 protected override void BeginProcessing()
 {
     _pipe.Begin(MyInvocation.ExpectingInput);
 }