/// <summary>
        /// Constructor for InvocationInfo object
        /// </summary>
        /// <param name="commandInfo">
        /// The command information the invocation info represents.
        /// </param>
        /// <param name="scriptPosition">
        /// The position representing the invocation, or the position representing the error.
        /// </param>
        /// <param name="context">
        /// The context in which the InvocationInfo is being created.
        /// </param>
        internal InvocationInfo(CommandInfo commandInfo, IScriptExtent scriptPosition, ExecutionContext context)
        {
            MyCommand       = commandInfo;
            CommandOrigin   = CommandOrigin.Internal;
            _scriptPosition = scriptPosition;

            ExecutionContext contextToUse = null;

            if ((commandInfo != null) && (commandInfo.Context != null))
            {
                contextToUse = commandInfo.Context;
            }
            else if (context != null)
            {
                contextToUse = context;
            }

            // Populate the history ID of this command
            if (contextToUse != null)
            {
                Runspaces.LocalRunspace localRunspace = contextToUse.CurrentRunspace as Runspaces.LocalRunspace;
                if (localRunspace != null && localRunspace.History != null)
                {
                    HistoryId = localRunspace.History.GetNextHistoryId();
                }
            }
        }
示例#2
0
 internal LocalPipeline(
     LocalRunspace runspace,
     string command,
     bool addToHistory,
     bool isNested)
     : base((Runspace)runspace, command, addToHistory, isNested)
 {
     this._stopper = new PipelineStopper(this);
     this.InitStreams();
 }
示例#3
0
 /// <summary>
 /// Create a Pipeline with an existing command string.
 /// Caller should validate all the parameters.
 /// </summary>
 /// <param name="runspace">
 /// The LocalRunspace to associate with this pipeline.
 /// </param>
 /// <param name="command">
 /// The command to execute.
 /// </param>
 /// <param name="addToHistory">
 /// If true, add the command(s) to the history list of the runspace.
 /// </param>
 /// <param name="isNested">
 /// If true, mark this pipeline as a nested pipeline.
 /// </param>
 /// <param name="inputStream">
 /// Stream to use for reading input objects.
 /// </param>
 /// <param name="errorStream">
 /// Stream to use for writing error objects.
 /// </param>
 /// <param name="outputStream">
 /// Stream to use for writing output objects.
 /// </param>
 /// <param name="infoBuffers">
 /// Buffers used to write progress, verbose, debug, warning, information
 /// information of an invocation.
 /// </param>
 internal LocalPipeline(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)
 {
     _stopper = new PipelineStopper(this);
     InitStreams();
 }
示例#4
0
 internal LocalPipeline(
     LocalRunspace runspace,
     CommandCollection command,
     bool addToHistory,
     bool isNested,
     ObjectStreamBase inputStream,
     ObjectStreamBase outputStream,
     ObjectStreamBase errorStream,
     PSInformationalBuffers infoBuffers)
     : base((Runspace)runspace, command, addToHistory, isNested, inputStream, outputStream, errorStream, infoBuffers)
 {
     this._stopper = new PipelineStopper(this);
     this.InitStreams();
 }
示例#5
0
 internal SessionStateProxy(LocalRunspace runspace)
 {
     _runspace = runspace;
 }
示例#6
0
 /// <summary>
 /// Create a Pipeline with an existing command string.
 /// </summary>
 /// <param name="runspace">The LocalRunspace to associate with this
 /// pipeline.
 /// </param>
 /// <param name="command">The command string to parse.</param>
 /// <param name="addToHistory">if true, add pipeline to history</param>
 /// <param name="isNested">True for nested pipeline</param>
 internal LocalPipeline(LocalRunspace runspace, string command, bool addToHistory, bool isNested)
     : base((Runspace)runspace, command, addToHistory, isNested)
 {
     _stopper = new PipelineStopper(this);
     InitStreams();
 }