Пример #1
0
 internal static FormatEntryData GenerateOutOfBandObjectAsToString(PSObject so)
 {
     FormatEntryData data = new FormatEntryData {
         outOfBand = true
     };
     RawTextFormatEntry entry = new RawTextFormatEntry {
         text = so.ToString()
     };
     data.formatEntryInfo = entry;
     return data;
 }
Пример #2
0
        internal static FormatEntryData GenerateOutOfBandObjectAsToString(PSObject so)
        {
            FormatEntryData data = new FormatEntryData {
                outOfBand = true
            };
            RawTextFormatEntry entry = new RawTextFormatEntry {
                text = so.ToString()
            };

            data.formatEntryInfo = entry;
            return(data);
        }
Пример #3
0
        private void ProcessOutOfBandPayload(FormatEntryData fed)
        {
            // try if it is raw text
            RawTextFormatEntry rte = fed.formatEntryInfo as RawTextFormatEntry;

            if (rte != null)
            {
                if (fed.isHelpObject)
                {
                    ComplexWriter complexWriter = new ComplexWriter();

                    complexWriter.Initialize(_lo, _lo.ColumnNumber);
                    complexWriter.WriteString(rte.text);
                }
                else
                {
                    _lo.WriteLine(rte.text);
                }

                return;
            }

            // try if it is a complex entry
            ComplexViewEntry cve = fed.formatEntryInfo as ComplexViewEntry;

            if (cve != null && cve.formatValueList != null)
            {
                ComplexWriter complexWriter = new ComplexWriter();

                complexWriter.Initialize(_lo, int.MaxValue);
                complexWriter.WriteObject(cve.formatValueList);

                return;
            }
            // try if it is a list view
            ListViewEntry lve = fed.formatEntryInfo as ListViewEntry;

            if (lve != null && lve.listViewFieldList != null)
            {
                ListWriter listWriter = new ListWriter();

                _lo.WriteLine("");

                string[] properties = ListOutputContext.GetProperties(lve);
                listWriter.Initialize(properties, _lo.ColumnNumber, _lo.DisplayCells);
                string[] values = ListOutputContext.GetValues(lve);
                listWriter.WriteProperties(values, _lo);

                _lo.WriteLine("");

                return;
            }
        }
Пример #4
0
        internal static FormatEntryData GenerateOutOfBandObjectAsToString(PSObject so)
        {
            FormatEntryData fed = new FormatEntryData();

            fed.outOfBand = true;

            RawTextFormatEntry rawTextEntry = new RawTextFormatEntry();

            rawTextEntry.text   = so.ToString();
            fed.formatEntryInfo = rawTextEntry;

            return(fed);
        }
Пример #5
0
        private void ProcessOutOfBandPayload(FormatEntryData fed)
        {
            RawTextFormatEntry formatEntryInfo = fed.formatEntryInfo as RawTextFormatEntry;

            if (formatEntryInfo != null)
            {
                if (fed.isHelpObject)
                {
                    ComplexWriter writer = new ComplexWriter();
                    writer.Initialize(this.lo, this.lo.ColumnNumber);
                    writer.WriteString(formatEntryInfo.text);
                }
                else
                {
                    this.lo.WriteLine(formatEntryInfo.text);
                }
            }
            else
            {
                ComplexViewEntry entry2 = fed.formatEntryInfo as ComplexViewEntry;
                if ((entry2 != null) && (entry2.formatValueList != null))
                {
                    ComplexWriter writer2 = new ComplexWriter();
                    writer2.Initialize(this.lo, this.lo.ColumnNumber);
                    writer2.WriteObject(entry2.formatValueList);
                }
                else
                {
                    ListViewEntry lve = fed.formatEntryInfo as ListViewEntry;
                    if ((lve != null) && (lve.listViewFieldList != null))
                    {
                        ListWriter writer3 = new ListWriter();
                        this.lo.WriteLine("");
                        string[] properties = ListOutputContext.GetProperties(lve);
                        writer3.Initialize(properties, this.lo.ColumnNumber, this.lo.DisplayCells);
                        string[] values = ListOutputContext.GetValues(lve);
                        writer3.WriteProperties(values, this.lo);
                        this.lo.WriteLine("");
                    }
                }
            }
        }
Пример #6
0
        internal static FormatEntryData GenerateOutOfBandObjectAsToString(PSObject so)
        {
            FormatEntryData fed = new FormatEntryData();
            fed.outOfBand = true;

            RawTextFormatEntry rawTextEntry = new RawTextFormatEntry();
            rawTextEntry.text = so.ToString();
            fed.formatEntryInfo = rawTextEntry;

            return fed;
        }