Ejemplo n.º 1
0
            /// <summary>
            /// initialize column widths
            /// </summary>
            internal override void Initialize()
            {
                // set the hard wider default, to be used if no other info is available
                int itemsPerRow = 2;

                // get the header info and the view hint
                WideFormattingHint hint = this.InnerCommand.RetrieveFormattingHint() as WideFormattingHint;

                int columnsOnTheScreen = GetConsoleWindowWidth(this.InnerCommand._lo.ColumnNumber);

                // give a preference to the hint, if there
                if (hint != null && hint.maxWidth > 0)
                {
                    itemsPerRow = TableWriter.ComputeWideViewBestItemsPerRowFit(hint.maxWidth, columnsOnTheScreen);
                }
                else if (this.CurrentWideHeaderInfo.columns > 0)
                {
                    itemsPerRow = this.CurrentWideHeaderInfo.columns;
                }

                // create a buffer object to hold partial rows
                _buffer = new StringValuesBuffer(itemsPerRow);

                // initialize the writer
                Span <int> columnWidths = stackalloc int[itemsPerRow];
                Span <int> alignment    = stackalloc int[itemsPerRow];

                for (int k = 0; k < itemsPerRow; k++)
                {
                    columnWidths[k] = 0; // autosize
                    alignment[k]    = TextAlignment.Left;
                }

                this.Writer.Initialize(0, columnsOnTheScreen, columnWidths, alignment, false);
            }
Ejemplo n.º 2
0
 private void ProcessCachedGroupOnWide(WideViewHeaderInfo wvhi, List <PacketInfoData> objects)
 {
     if (wvhi.columns == 0)
     {
         int num = 0;
         foreach (PacketInfoData data in objects)
         {
             FormatEntryData data2 = data as FormatEntryData;
             if (data2 != null)
             {
                 WideViewEntry       formatEntryInfo     = data2.formatEntryInfo as WideViewEntry;
                 FormatPropertyField formatPropertyField = formatEntryInfo.formatPropertyField;
                 if (!string.IsNullOrEmpty(formatPropertyField.propertyValue))
                 {
                     int num2 = this.lo.DisplayCells.Length(formatPropertyField.propertyValue);
                     if (num2 > num)
                     {
                         num = num2;
                     }
                 }
             }
         }
         WideFormattingHint hint = new WideFormattingHint {
             maxWidth = num
         };
         this.formattingHint = hint;
     }
 }
Ejemplo n.º 3
0
        private void ProcessCachedGroupOnWide(WideViewHeaderInfo wvhi, List <PacketInfoData> objects)
        {
            if (wvhi.columns != 0)
            {
                // columns forced on the client
                return;
            }

            int maxLen = 0;
            int cellCount; // scratch variable

            foreach (PacketInfoData o in objects)
            {
                FormatEntryData fed = o as FormatEntryData;

                if (fed == null)
                {
                    continue;
                }

                WideViewEntry       wve = fed.formatEntryInfo as WideViewEntry;
                FormatPropertyField fpf = wve.formatPropertyField as FormatPropertyField;

                if (!string.IsNullOrEmpty(fpf.propertyValue))
                {
                    cellCount = _lo.DisplayCells.Length(fpf.propertyValue);
                    if (cellCount > maxLen)
                    {
                        maxLen = cellCount;
                    }
                }
            }

            WideFormattingHint hint = new WideFormattingHint();

            hint.maxWidth   = maxLen;
            _formattingHint = hint;
        }
Ejemplo n.º 4
0
        private void ProcessCachedGroupOnWide(WideViewHeaderInfo wvhi, List<PacketInfoData> objects)
        {
            if (wvhi.columns != 0)
            {
                // columns forced on the client
                return;
            }

            int maxLen = 0;
            int cellCount; // scratch variable

            foreach (PacketInfoData o in objects)
            {
                FormatEntryData fed = o as FormatEntryData;

                if (fed == null)
                    continue;

                WideViewEntry wve = fed.formatEntryInfo as WideViewEntry;
                FormatPropertyField fpf = wve.formatPropertyField as FormatPropertyField;

                if (!string.IsNullOrEmpty(fpf.propertyValue))
                {
                    cellCount = _lo.DisplayCells.Length(fpf.propertyValue);
                    if (cellCount > maxLen)
                        maxLen = cellCount;
                }
            }

            WideFormattingHint hint = new WideFormattingHint();

            hint.maxWidth = maxLen;
            _formattingHint = hint;
        }
Ejemplo n.º 5
0
 private void ProcessCachedGroupOnWide(WideViewHeaderInfo wvhi, List<PacketInfoData> objects)
 {
     if (wvhi.columns == 0)
     {
         int num = 0;
         foreach (PacketInfoData data in objects)
         {
             FormatEntryData data2 = data as FormatEntryData;
             if (data2 != null)
             {
                 WideViewEntry formatEntryInfo = data2.formatEntryInfo as WideViewEntry;
                 FormatPropertyField formatPropertyField = formatEntryInfo.formatPropertyField;
                 if (!string.IsNullOrEmpty(formatPropertyField.propertyValue))
                 {
                     int num2 = this.lo.DisplayCells.Length(formatPropertyField.propertyValue);
                     if (num2 > num)
                     {
                         num = num2;
                     }
                 }
             }
         }
         WideFormattingHint hint = new WideFormattingHint {
             maxWidth = num
         };
         this.formattingHint = hint;
     }
 }