コード例 #1
0
 internal CmdletParameterBinderController(Cmdlet cmdlet, CommandMetadata commandMetadata, ParameterBinderBase parameterBinder)
     : base(cmdlet.MyInvocation, cmdlet.Context, parameterBinder)
 {
     this._warningSet = new HashSet<string>();
     this._useDefaultParameterBinding = true;
     this._delayBindScriptBlocks = new Dictionary<MergedCompiledCommandParameter, DelayedScriptBlockArgument>();
     this._defaultParameterValues = new Dictionary<string, CommandParameterInternal>(StringComparer.OrdinalIgnoreCase);
     if (cmdlet == null)
     {
         throw PSTraceSource.NewArgumentNullException("cmdlet");
     }
     if (commandMetadata == null)
     {
         throw PSTraceSource.NewArgumentNullException("commandMetadata");
     }
     this.Command = cmdlet;
     this._commandRuntime = (MshCommandRuntime)cmdlet.CommandRuntime;
     this._commandMetadata = commandMetadata;
     if (commandMetadata.ImplementsDynamicParameters)
     {
         base.UnboundParameters = base.BindableParameters.ReplaceMetadata(commandMetadata.StaticCommandParameterMetadata);
         base.BindableParameters.GenerateParameterSetMappingFromMetadata(commandMetadata.DefaultParameterSetName);
     }
     else
     {
         base._bindableParameters = commandMetadata.StaticCommandParameterMetadata;
         base.UnboundParameters = new List<MergedCompiledCommandParameter>(base._bindableParameters.BindableParameters.Values);
     }
 }
コード例 #2
0
 internal ShouldProcessParameters(MshCommandRuntime commandRuntime)
 {
     if (commandRuntime == null)
     {
         throw PSTraceSource.NewArgumentNullException("commandRuntime");
     }
     this.commandRuntime = commandRuntime;
 }
コード例 #3
0
ファイル: PagingParameters.cs プロジェクト: nickchal/pash
 internal PagingParameters(MshCommandRuntime commandRuntime)
 {
     if (commandRuntime == null)
     {
         throw PSTraceSource.NewArgumentNullException("commandRuntime");
     }
     commandRuntime.PagingParameters = this;
 }
コード例 #4
0
 internal CommandInvocationIntrinsics(System.Management.Automation.ExecutionContext context, PSCmdlet cmdlet)
 {
     this._context = context;
     if (cmdlet != null)
     {
         this._cmdlet = cmdlet;
         this.commandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
     }
 }
コード例 #5
0
ファイル: PSScriptCmdlet.cs プロジェクト: nickchal/pash
 protected override void BeginProcessing()
 {
     this._commandRuntime = (MshCommandRuntime) base.commandRuntime;
     this._functionContext._outputPipe = this._commandRuntime.OutputPipe;
     this.SetPreferenceVariables();
     if (this._scriptBlock.HasBeginBlock)
     {
         this.RunClause(this._runOptimized ? this._scriptBlock.BeginBlock : this._scriptBlock.UnoptimizedBeginBlock, AutomationNull.Value, this._input);
     }
 }
コード例 #6
0
ファイル: CompiledScriptBlock.cs プロジェクト: 40a/PowerShell
        public object GetDynamicParameters()
        {
            _commandRuntime = (MshCommandRuntime)commandRuntime;

            if (_scriptBlock.HasDynamicParameters)
            {
                var resultList = new List<object>();
                Diagnostics.Assert(_functionContext._outputPipe == null, "Output pipe should not be set yet.");
                _functionContext._outputPipe = new Pipe(resultList);
                RunClause(_runOptimized ? _scriptBlock.DynamicParamBlock : _scriptBlock.UnoptimizedDynamicParamBlock,
                          AutomationNull.Value, AutomationNull.Value);
                if (resultList.Count > 1)
                {
                    throw PSTraceSource.NewInvalidOperationException(AutomationExceptions.DynamicParametersWrongType,
                        PSObject.ToStringParser(this.Context, resultList));
                }
                return resultList.Count == 0 ? null : PSObject.Base(resultList[0]);
            }

            return null;
        }
コード例 #7
0
ファイル: CompiledScriptBlock.cs プロジェクト: 40a/PowerShell
        protected override void BeginProcessing()
        {
            // commandRuntime and the execution context are set here and in GetDynamicParameters.  GetDynamicParameters isn't
            // called unless the scriptblock has a dynamicparam block, so we must set these values in both places.  It'd
            // be cleaner to set in the constructor, but neither the commandRuntime nor the context are set when being constructed.
            _commandRuntime = (MshCommandRuntime)commandRuntime;

            // We don't set the output pipe until after GetDynamicParameters because dynamic parameters aren't written to the
            // command processors pipe, but once we enter begin, we will write to the default pipe.
            _functionContext._outputPipe = _commandRuntime.OutputPipe;

            SetPreferenceVariables();

            if (_scriptBlock.HasBeginBlock)
            {
                RunClause(_runOptimized ? _scriptBlock.BeginBlock : _scriptBlock.UnoptimizedBeginBlock, AutomationNull.Value, _input);
            }
        }
コード例 #8
0
ファイル: MshCmdlet.cs プロジェクト: 40a/PowerShell
 internal CommandInvocationIntrinsics(ExecutionContext context, PSCmdlet cmdlet)
 {
     _context = context;
     if (cmdlet != null)
     {
         _cmdlet = cmdlet;
         _commandRuntime = cmdlet.CommandRuntime as MshCommandRuntime;
     }
 }
コード例 #9
0
ファイル: Command.cs プロジェクト: nickchal/pash
 private Pipe GetRedirectionPipe(PipelineResultTypes toType, MshCommandRuntime mcr)
 {
     if (toType == PipelineResultTypes.Output)
     {
         return mcr.OutputPipe;
     }
     return new Pipe { NullPipe = true };
 }
コード例 #10
0
 internal TransactionParameters(MshCommandRuntime commandRuntime)
 {
     this.commandRuntime = commandRuntime;
 }
コード例 #11
0
ファイル: MshCommandRuntime.cs プロジェクト: nickchal/pash
 internal void SetMergeFromRuntime(MshCommandRuntime fromRuntime)
 {
     this.ErrorMergeTo = fromRuntime.ErrorMergeTo;
     if (fromRuntime.WarningOutputPipe != null)
     {
         this.WarningOutputPipe = fromRuntime.WarningOutputPipe;
     }
     if (fromRuntime.VerboseOutputPipe != null)
     {
         this.VerboseOutputPipe = fromRuntime.VerboseOutputPipe;
     }
     if (fromRuntime.DebugOutputPipe != null)
     {
         this.DebugOutputPipe = fromRuntime.DebugOutputPipe;
     }
 }
コード例 #12
0
ファイル: PSScriptCmdlet.cs プロジェクト: nickchal/pash
 public object GetDynamicParameters()
 {
     this._commandRuntime = (MshCommandRuntime) base.commandRuntime;
     if (this._scriptBlock.HasDynamicParameters)
     {
         ArrayList resultList = new ArrayList();
         this._functionContext._outputPipe = new Pipe(resultList);
         this.RunClause(this._runOptimized ? this._scriptBlock.DynamicParamBlock : this._scriptBlock.UnoptimizedDynamicParamBlock, AutomationNull.Value, AutomationNull.Value);
         if (resultList.Count > 1)
         {
             throw PSTraceSource.NewInvalidOperationException("AutomationExceptions", "DynamicParametersWrongType", new object[] { PSObject.ToStringParser(base.Context, resultList) });
         }
         if (resultList.Count != 0)
         {
             return PSObject.Base(resultList[0]);
         }
     }
     return null;
 }