Exemple #1
0
        /// <summary>
        /// process the current payload object
        /// </summary>
        /// <param name="fed">FormatEntryData to process</param>
        /// <param name="c">currently active context</param>
        private void ProcessPayload(FormatEntryData fed, FormatMessagesContextManager.OutputContext c)
        {
            // we assume FormatEntryData as a standard wrapper
            if (fed == null)
            {
                PSTraceSource.NewArgumentNullException("fed");
            }
            if (fed.formatEntryInfo == null)
            {
                PSTraceSource.NewArgumentNullException("fed.formatEntryInfo");
            }

            WriteStreamType oldWSState = _lo.WriteStream;

            try
            {
                _lo.WriteStream = fed.writeStream;

                if (c == null)
                {
                    ProcessOutOfBandPayload(fed);
                }
                else
                {
                    GroupOutputContext goc = (GroupOutputContext)c;

                    goc.ProcessPayload(fed);
                }
            }
            finally
            {
                _lo.WriteStream = oldWSState;
            }
        }
Exemple #2
0
        private void ProcessPayload(FormatEntryData fed, FormatMessagesContextManager.OutputContext c)
        {
            if (fed == null)
            {
                PSTraceSource.NewArgumentNullException("fed");
            }
            if (fed.formatEntryInfo == null)
            {
                PSTraceSource.NewArgumentNullException("fed.formatEntryInfo");
            }
            WriteStreamType writeStream = this.lo.WriteStream;

            try
            {
                this.lo.WriteStream = fed.writeStream;
                if (c == null)
                {
                    this.ProcessOutOfBandPayload(fed);
                }
                else
                {
                    ((GroupOutputContext)c).ProcessPayload(fed);
                }
            }
            finally
            {
                this.lo.WriteStream = writeStream;
            }
        }
 /// <summary>
 /// Helper method to set the WriteStreamType property
 /// based on note properties of a PSObject object.
 /// </summary>
 /// <param name="so">PSObject.</param>
 internal void SetStreamTypeFromPSObject(
     System.Management.Automation.PSObject so)
 {
     if (PSObjectHelper.IsWriteErrorStream(so))
     {
         writeStream = WriteStreamType.Error;
     }
     else if (PSObjectHelper.IsWriteWarningStream(so))
     {
         writeStream = WriteStreamType.Warning;
     }
     else if (PSObjectHelper.IsWriteVerboseStream(so))
     {
         writeStream = WriteStreamType.Verbose;
     }
     else if (PSObjectHelper.IsWriteDebugStream(so))
     {
         writeStream = WriteStreamType.Debug;
     }
     else if (PSObjectHelper.IsWriteInformationStream(so))
     {
         writeStream = WriteStreamType.Information;
     }
     else
     {
         writeStream = WriteStreamType.None;
     }
 }
 internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
 {
     base.Deserialize(so, deserializer);
     this.formatEntryInfo = (FormatEntryInfo)deserializer.DeserializeMandatoryMemberObject(so, "formatEntryInfo");
     this.outOfBand       = deserializer.DeserializeBoolMemberVariable(so, "outOfBand");
     this.writeStream     = deserializer.DeserializeWriteStreamTypeMemberVariable(so);
     this.isHelpObject    = so.IsHelpObject;
 }
Exemple #5
0
 internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
 {
     base.Deserialize(so, deserializer);
     this.formatEntryInfo = (FormatEntryInfo) deserializer.DeserializeMandatoryMemberObject(so, "formatEntryInfo");
     this.outOfBand = deserializer.DeserializeBoolMemberVariable(so, "outOfBand");
     this.writeStream = deserializer.DeserializeWriteStreamTypeMemberVariable(so);
     this.isHelpObject = so.IsHelpObject;
 }
 internal void SetStreamTypeFromPSObject(PSObject so)
 {
     if (PSObjectHelper.IsWriteErrorStream(so))
     {
         this.writeStream = WriteStreamType.Error;
     }
     else if (PSObjectHelper.IsWriteWarningStream(so))
     {
         this.writeStream = WriteStreamType.Warning;
     }
     else if (PSObjectHelper.IsWriteVerboseStream(so))
     {
         this.writeStream = WriteStreamType.Verbose;
     }
     else if (PSObjectHelper.IsWriteDebugStream(so))
     {
         this.writeStream = WriteStreamType.Debug;
     }
     else
     {
         this.writeStream = WriteStreamType.None;
     }
 }
Exemple #7
0
 internal void SetStreamTypeFromPSObject(PSObject so)
 {
     if (PSObjectHelper.IsWriteErrorStream(so))
     {
         this.writeStream = WriteStreamType.Error;
     }
     else if (PSObjectHelper.IsWriteWarningStream(so))
     {
         this.writeStream = WriteStreamType.Warning;
     }
     else if (PSObjectHelper.IsWriteVerboseStream(so))
     {
         this.writeStream = WriteStreamType.Verbose;
     }
     else if (PSObjectHelper.IsWriteDebugStream(so))
     {
         this.writeStream = WriteStreamType.Debug;
     }
     else
     {
         this.writeStream = WriteStreamType.None;
     }
 }
Exemple #8
0
 /// <summary>
 /// Helper method to set the WriteStreamType property
 /// based on note properties of a PSObject object.
 /// </summary>
 /// <param name="so">PSObject</param>
 internal void SetStreamTypeFromPSObject(
     System.Management.Automation.PSObject so)
 {
     if (PSObjectHelper.IsWriteErrorStream(so))
     {
         writeStream = WriteStreamType.Error;
     }
     else if (PSObjectHelper.IsWriteWarningStream(so))
     {
         writeStream = WriteStreamType.Warning;
     }
     else if (PSObjectHelper.IsWriteVerboseStream(so))
     {
         writeStream = WriteStreamType.Verbose;
     }
     else if (PSObjectHelper.IsWriteDebugStream(so))
     {
         writeStream = WriteStreamType.Debug;
     }
     else if (PSObjectHelper.IsWriteInformationStream(so))
     {
         writeStream = WriteStreamType.Information;
     }
     else
     {
         writeStream = WriteStreamType.None;
     }
 }