コード例 #1
0
ファイル: Pipeline.cs プロジェクト: wonho21/PowerShell
 /// <summary>
 /// Sets the command collection.
 /// </summary>
 /// <param name="commands">Command collection to set.</param>
 /// <remarks>called by ClientRemotePipeline</remarks>
 internal void SetCommandCollection(CommandCollection commands)
 {
     Commands = commands;
 }
コード例 #2
0
 // internals
 internal Pipeline()
 {
     Commands = new CommandCollection();
 }
コード例 #3
0
ファイル: LocalPipeline.cs プロジェクト: modulexcite/pash-1
        private PipelineProcessor CreatePipelineProcessor()
        {
            PipelineProcessor processor2;
            CommandCollection commands = base.Commands;

            if ((commands == null) || (commands.Count == 0))
            {
                throw PSTraceSource.NewInvalidOperationException("RunspaceStrings", "NoCommandInPipeline", new object[0]);
            }
            PipelineProcessor processor = new PipelineProcessor {
                TopLevel = true
            };
            bool flag = false;

            try
            {
                foreach (Command command in commands)
                {
                    CommandProcessorBase base2;
                    if (command.CommandInfo == null)
                    {
                        base2 = command.CreateCommandProcessor(this.LocalRunspace.ExecutionContext, this.LocalRunspace.CommandFactory, base.AddToHistory, this.IsNested ? CommandOrigin.Internal : CommandOrigin.Runspace);
                    }
                    else
                    {
                        CmdletInfo commandInfo = (CmdletInfo)command.CommandInfo;
                        base2 = new CommandProcessor(commandInfo, this.LocalRunspace.ExecutionContext);
                        PSSQMAPI.IncrementData(commandInfo.CommandType);
                        base2.Command.CommandOriginInternal       = CommandOrigin.Internal;
                        base2.Command.MyInvocation.InvocationName = commandInfo.Name;
                        if (command.Parameters != null)
                        {
                            foreach (CommandParameter parameter in command.Parameters)
                            {
                                CommandParameterInternal internal2 = CommandParameter.ToCommandParameterInternal(parameter, false);
                                base2.AddParameter(internal2);
                            }
                        }
                    }
                    base2.RedirectShellErrorOutputPipe = base.RedirectShellErrorOutputPipe;
                    processor.Add(base2);
                }
                processor2 = processor;
            }
            catch (RuntimeException)
            {
                flag = true;
                throw;
            }
            catch (Exception exception)
            {
                flag = true;
                CommandProcessorBase.CheckForSevereException(exception);
                throw new RuntimeException(PipelineStrings.CannotCreatePipeline, exception);
            }
            finally
            {
                if (flag)
                {
                    base.SetHadErrors(true);
                    processor.Dispose();
                }
            }
            return(processor2);
        }
コード例 #4
0
ファイル: PipelineBase.cs プロジェクト: modulexcite/pash-1
 protected PipelineBase(System.Management.Automation.Runspaces.Runspace runspace, CommandCollection command, bool addToHistory, bool isNested, ObjectStreamBase inputStream, ObjectStreamBase outputStream, ObjectStreamBase errorStream, PSInformationalBuffers infoBuffers) : base(runspace, command)
 {
     this._pipelineStateInfo   = new System.Management.Automation.Runspaces.PipelineStateInfo(System.Management.Automation.Runspaces.PipelineState.NotStarted);
     this._performNestedCheck  = true;
     this._executionEventQueue = new Queue <ExecutionEventQueueItem>();
     this._syncRoot            = new object();
     this.Initialize(runspace, null, false, isNested);
     if (addToHistory)
     {
         string commandStringForHistory = command.GetCommandStringForHistory();
         this._historyString = commandStringForHistory;
         this._addToHistory  = addToHistory;
     }
     this._inputStream          = inputStream;
     this._outputStream         = outputStream;
     this._errorStream          = errorStream;
     this._informationalBuffers = infoBuffers;
 }
コード例 #5
0
ファイル: LocalPipeline.cs プロジェクト: modulexcite/pash-1
 internal LocalPipeline(System.Management.Automation.Runspaces.LocalRunspace runspace, CommandCollection command, bool addToHistory, bool isNested, ObjectStreamBase inputStream, ObjectStreamBase outputStream, ObjectStreamBase errorStream, PSInformationalBuffers infoBuffers) : base(runspace, command, addToHistory, isNested, inputStream, outputStream, errorStream, infoBuffers)
 {
     this._historyIdForThisPipeline = -1L;
     this._invokeHistoryIds         = new List <long>();
     this._stopper = new PipelineStopper(this);
     this.InitStreams();
 }