internal CustomAsyncCommandRuntime(PSCmdlet cmdlet, CancellationToken cancellationToken)
 {
     _originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2;
     _originalThread         = Thread.CurrentThread;
     CancellationToken       = cancellationToken;
     _cmdlet = cmdlet;
     cmdlet.CommandRuntime = this;
 }
コード例 #2
0
 internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken)
 {
     this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2;
     this.originalThread         = System.Threading.Thread.CurrentThread;
     this.cancellationToken      = cancellationToken;
     this.cmdlet           = cmdlet;
     cmdlet.CommandRuntime = this;
 }
コード例 #3
0
ファイル: PipelineLogger.cs プロジェクト: gengle/PSRule
 internal void UseCommandRuntime(ICommandRuntime2 commandRuntime)
 {
     OnWriteVerbose     = commandRuntime.WriteVerbose;
     OnWriteWarning     = commandRuntime.WriteWarning;
     OnWriteError       = commandRuntime.WriteError;
     OnWriteInformation = commandRuntime.WriteInformation;
     OnWriteDebug       = commandRuntime.WriteDebug;
     OnWriteObject      = commandRuntime.WriteObject;
 }
コード例 #4
0
 internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken)
 {
     this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2;
     this.originalThread         = System.Threading.Thread.CurrentThread;
     this.cancellationToken      = cancellationToken;
     this.cmdlet = cmdlet;
     if (cmdlet.PagingParameters != null)
     {
         WriteDebug("Client side pagination is enabled for this cmdlet");
     }
     cmdlet.CommandRuntime = this;
 }
コード例 #5
0
        internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name)
        {
            SetJobState(JobState.NotStarted);
            // know how to cancel/check for cancelation
            this.CancellationToken = cancellationToken;
            this.Cancel            = cancelMethod;

            // we might need these.
            this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2;
            this.originalThread         = System.Threading.Thread.CurrentThread;

            // the instance of the cmdlet we're going to run
            this.cmdlet = cmdlet;

            // set the command runtime to the AsyncJob
            cmdlet.CommandRuntime = this;
        }
コード例 #6
0
 public virtual void UseCommandRuntime(ICommandRuntime2 commandRuntime)
 {
     //Logger.UseCommandRuntime(commandRuntime);
     Output        = commandRuntime.WriteObject;
     ShouldProcess = commandRuntime.ShouldProcess;
 }
コード例 #7
0
 public virtual void UseCommandRuntime(ICommandRuntime2 commandRuntime)
 {
     // Do nothing
 }
コード例 #8
0
 public void UseCommandRuntime(ICommandRuntime2 commandRuntime)
 {
     _Logger.UseCommandRuntime(commandRuntime);
 }