コード例 #1
0
 internal void AddVerbose(VerboseRecord item)
 {
     if (this.verbose != null)
     {
         this.verbose.InternalAdd(this.psInstanceId, item);
     }
 }
コード例 #2
0
        /// <summary>
        /// Send the specified verbose record to client
        /// </summary>
        /// <param name="record">warning record</param>
        internal void SendVerboseRecordToClient(VerboseRecord record)
        {
            record.SerializeExtendedInfo = (_streamSerializationOptions & RemoteStreamOptions.AddInvocationInfoToVerboseRecord) != 0;

            SendDataAsync(RemotingEncoder.GeneratePowerShellInformational(
                              record, _clientRunspacePoolId, _clientPowerShellId, RemotingDataType.PowerShellVerbose));
        }
コード例 #3
0
 internal void AddVerbose(VerboseRecord item)
 {
     if (this.verbose != null)
     {
         this.verbose.InternalAdd(this.psInstanceId, item);
     }
 }
コード例 #4
0
 internal void SendVerboseRecordToClient(VerboseRecord record)
 {
     using (ServerPowerShellDataStructureHandler.tracer.TraceMethod())
     {
         record.SerializeExtendedInfo = (this.streamSerializationOptions & RemoteStreamOptions.AddInvocationInfoToVerboseRecord) != (RemoteStreamOptions)0;
         this.SendDataAsync(RemotingEncoder.GeneratePowerShellInformational((object)record, this.clientRunspacePoolId, this.clientPowerShellId, RemotingDataType.PowerShellVerbose));
     }
 }
コード例 #5
0
        private void HandleVerboseAdded(object sender, DataAddedEventArgs eventArgs)
        {
            int index = eventArgs.Index;

            lock (this.syncObject)
            {
                int num2 = !this.extraPowerShellAlreadyScheduled ? 0 : 1;
                if ((num2 == 0) && !this.datasent[num2])
                {
                    VerboseRecord record = this.localPowerShell.Streams.Verbose[index];
                    this.localPowerShell.Streams.Verbose.RemoveAt(index);
                    this.dsHandler.SendVerboseRecordToClient(record);
                }
            }
        }
コード例 #6
0
 private void HandleVerboseAdded(object sender, DataAddedEventArgs eventArgs)
 {
     using (ServerPowerShellDriver.tracer.TraceEventHandlers())
     {
         int index = eventArgs.Index;
         lock (this.syncObject)
         {
             if (this.datasent)
             {
                 return;
             }
             VerboseRecord record = this.localPowerShell.Streams.Verbose[index];
             this.localPowerShell.Streams.Verbose.RemoveAt(index);
             this.dsHandler.SendVerboseRecordToClient(record);
         }
     }
 }
コード例 #7
0
ファイル: WriteVerboseCommand.cs プロジェクト: nickchal/pash
 protected override void ProcessRecord()
 {
     MshCommandRuntime commandRuntime = base.CommandRuntime as MshCommandRuntime;
     if (commandRuntime != null)
     {
         VerboseRecord record = new VerboseRecord(this.Message);
         InvocationInfo variableValue = base.GetVariableValue("MyInvocation") as InvocationInfo;
         if (variableValue != null)
         {
             record.SetInvocationInfo(variableValue);
         }
         commandRuntime.WriteVerbose(record, false);
     }
     else
     {
         base.WriteVerbose(this.Message);
     }
 }
コード例 #8
0
        /// <summary>
        /// Handles DataAdded from Verbose of PowerShell
        /// </summary>
        /// <param name="sender">sender of this information, unused</param>
        /// <param name="eventArgs">sender of this information</param>
        private void HandleVerboseAdded(object sender, DataAddedEventArgs eventArgs)
        {
            int index = eventArgs.Index;

            lock (_syncObject)
            {
                int indexIntoDataSent = (!_extraPowerShellAlreadyScheduled) ? 0 : 1;
                if ((indexIntoDataSent == 0) && (!_datasent[indexIntoDataSent]))
                {
                    VerboseRecord data = LocalPowerShell.Streams.Verbose[index];
                    // once the debug message is sent, it is removed so that
                    // the same is not sent again by SendRemainingData() method
                    LocalPowerShell.Streams.Verbose.RemoveAt(index);

                    // send the output data to the client
                    DataStructureHandler.SendVerboseRecordToClient(data);
                }
            } // lock ..
        }
コード例 #9
0
 internal void SendVerboseRecordToClient(VerboseRecord record)
 {
     record.SerializeExtendedInfo = (this.streamSerializationOptions & RemoteStreamOptions.AddInvocationInfoToVerboseRecord) != 0;
     this.SendDataAsync(RemotingEncoder.GeneratePowerShellInformational(record, this.clientRunspacePoolId, this.clientPowerShellId, RemotingDataType.PowerShellVerbose));
 }
コード例 #10
0
 void Verbose_DataAdded(object sender, DataAddedEventArgs e)
 {
     PSDataCollection<VerboseRecord> collection = sender as PSDataCollection<VerboseRecord>;
     lastVerbose = collection[e.Index];
     PSObject psObj = new PSObject(lastVerbose);
     PSPropertyInfo propInfo = new PSNoteProperty("TimeStamp", DateTime.Now);
     psObj.Properties.Add(new PSNoteProperty("Stream", "Verbose"));
     psObj.Properties.Add(propInfo);
     timeStampedOutput.Add(psObj);
     if (Dispatcher != null)
     {
         RunOnUIThread(
                 new DispatcherOperationCallback(
                 delegate
                 {
                     NotifyVerboseChanged();
                     return null;
                 }),
                 true);
     }
     else
     {
         NotifyVerboseChanged();
     }
 }
コード例 #11
0
ファイル: MshCommandRuntime.cs プロジェクト: nickchal/pash
 internal void WriteVerbose(VerboseRecord record, bool overrideInquire = false)
 {
     ActionPreference verbosePreference = this.VerbosePreference;
     if (overrideInquire && (verbosePreference == ActionPreference.Inquire))
     {
         verbosePreference = ActionPreference.Continue;
     }
     if (this.WriteHelper_ShouldWrite(verbosePreference, this.lastVerboseContinueStatus))
     {
         if (record.InvocationInfo == null)
         {
             record.SetInvocationInfo(this.MyInvocation);
         }
         if (this.VerboseOutputPipe != null)
         {
             if (((this.CBhost != null) && (this.CBhost.InternalUI != null)) && this.VerboseOutputPipe.NullPipe)
             {
                 this.CBhost.InternalUI.WriteVerboseInfoBuffers(record);
             }
             PSObject obj2 = PSObject.AsPSObject(record);
             if (obj2.Members["WriteVerboseStream"] == null)
             {
                 obj2.Properties.Add(new PSNoteProperty("WriteVerboseStream", true));
             }
             this.VerboseOutputPipe.Add(obj2);
         }
         else
         {
             if ((this.Host == null) || (this.Host.UI == null))
             {
                 throw PSTraceSource.NewInvalidOperationException();
             }
             this.CBhost.InternalUI.WriteVerboseRecord(record);
         }
     }
     this.lastVerboseContinueStatus = this.WriteHelper(null, null, verbosePreference, this.lastVerboseContinueStatus, "VerbosePreference", record.Message);
 }
コード例 #12
0
 internal void WriteVerboseRecord(VerboseRecord record)
 {
     this.WriteVerboseInfoBuffers(record);
     if (this.externalUI != null)
     {
         this.externalUI.WriteVerboseLine(record.Message);
     }
 }
コード例 #13
0
 internal void WriteVerboseInfoBuffers(VerboseRecord record)
 {
     if (this.informationalBuffers != null)
     {
         this.informationalBuffers.AddVerbose(record);
     }
 }
コード例 #14
0
ファイル: MshCommandRuntime.cs プロジェクト: 40a/PowerShell
        /// <summary>
        /// Display verbose information
        /// </summary>
        internal void WriteVerbose(VerboseRecord record, bool overrideInquire = false)
        {
            ActionPreference preference = VerbosePreference;
            if (overrideInquire && preference == ActionPreference.Inquire)
                preference = ActionPreference.Continue;

            if (WriteHelper_ShouldWrite(preference, lastVerboseContinueStatus))
            {
                if (record.InvocationInfo == null)
                {
                    record.SetInvocationInfo(MyInvocation);
                }

                if (VerboseOutputPipe != null)
                {
                    if (CBhost != null && CBhost.InternalUI != null &&
                        VerboseOutputPipe.NullPipe)
                    {
                        // If redirecting to a null pipe, still write to
                        // information buffers.
                        CBhost.InternalUI.WriteVerboseInfoBuffers(record);
                    }

                    // Add note property so that the verbose output is formatted correctly.
                    PSObject verboseWrap = PSObject.AsPSObject(record);
                    if (verboseWrap.Members["WriteVerboseStream"] == null)
                    {
                        verboseWrap.Properties.Add(new PSNoteProperty("WriteVerboseStream", true));
                    }

                    VerboseOutputPipe.Add(verboseWrap);
                }
                else
                {
                    //
                    // If no pipe, write directly to host.
                    //
                    if (null == Host || null == Host.UI)
                    {
                        Diagnostics.Assert(false, "No host in CommandBase.WriteVerbose()");
                        throw PSTraceSource.NewInvalidOperationException();
                    }

                    CBhost.InternalUI.TranscribeResult(StringUtil.Format(InternalHostUserInterfaceStrings.VerboseFormatString, record.Message));
                    CBhost.InternalUI.WriteVerboseRecord(record);
                }
            }

            lastVerboseContinueStatus = WriteHelper(
                null,
                null,
                preference,
                lastVerboseContinueStatus,
                "VerbosePreference",
                record.Message);
        }
コード例 #15
0
ファイル: write.cs プロジェクト: 40a/PowerShell
        /// <summary>
        /// This method implements the ProcessRecord method for Write-verbose command
        /// </summary>
        protected override void ProcessRecord()
        {
            //
            // The write-verbose command must use the script's InvocationInfo rather than its own,
            // so we create the VerboseRecord here and fill it up with the appropriate InvocationInfo;
            // then, we call the command runtime directly and pass this record to WriteVerbose().
            //
            MshCommandRuntime mshCommandRuntime = this.CommandRuntime as MshCommandRuntime;

            if (mshCommandRuntime != null)
            {
                VerboseRecord record = new VerboseRecord(Message);

                InvocationInfo invocationInfo = GetVariableValue(SpecialVariables.MyInvocation) as InvocationInfo;

                if (invocationInfo != null)
                {
                    record.SetInvocationInfo(invocationInfo);
                }

                mshCommandRuntime.WriteVerbose(record);
            }
            else
            {
                WriteVerbose(Message);
            }
        }//processrecord
コード例 #16
0
 private void WriteVerboseRecord(RemoteComputer powershellComputer, VerboseRecord record) {
     powershellComputer.AddLogEntry(new LogEntry(powershellComputer.Name, record.Message, LogEntryType.Verbose));
 }