コード例 #1
0
 /// <summary>
 /// Create the scope for this script block and binding arguments in it
 /// </summary>
 public override void Prepare()
 {
     // TODO: check if it makes sense to move the scope handling to the PipelineProcessor!
     //Let's see on the long run if there is an easier solution for this #ExecutionContextChange
     CreateOwnScope();
     SwitchToOwnScope();
     try
     {
         MergeParameters();
         _argumentBinder = new ScriptBlockParameterBinder(_scriptBlockInfo.GetParameters(), ExecutionContext,
                                                          _scopedExecutionVisitor);
         _argumentBinder.BindCommandLineParameters(Parameters);
     }
     finally
     {
         RestoreOriginalScope();
     }
 }
コード例 #2
0
        private void BindArguments()
        {
            ReadOnlyCollection <ParameterAst> scriptParameters = _scriptBlockInfo.GetParameters();

            for (int i = 0; i < scriptParameters.Count; ++i)
            {
                ParameterAst     scriptParameter = scriptParameters[i];
                CommandParameter parameter       = GetParameterByPosition(i);
                object           parameterValue  = GetParameterValue(scriptParameter, parameter);

                ExecutionContext.SetVariable(scriptParameter.Name.VariablePath.UserPath, parameterValue);
            }
        }