Example #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);
            }
Example #2
0
            internal override void Initialize()
            {
                int size = 2;

                OutCommandInner.WideFormattingHint hint = base.InnerCommand.RetrieveFormattingHint() as OutCommandInner.WideFormattingHint;
                if ((hint != null) && (hint.maxWidth > 0))
                {
                    size = TableWriter.ComputeWideViewBestItemsPerRowFit(hint.maxWidth, base.InnerCommand.lo.ColumnNumber);
                }
                else if (this.CurrentWideHeaderInfo.columns > 0)
                {
                    size = this.CurrentWideHeaderInfo.columns;
                }
                this.buffer = new StringValuesBuffer(size);
                int[] columnWidths = new int[size];
                int[] alignment    = new int[size];
                for (int i = 0; i < size; i++)
                {
                    columnWidths[i] = 0;
                    alignment[i]    = 1;
                }
                base.Writer.Initialize(0, base.InnerCommand.lo.ColumnNumber, columnWidths, alignment, false);
            }
Example #3
0
 internal TableOutputContextBase(OutCommandInner cmd, FormatMessagesContextManager.OutputContext parentContext, GroupStartData formatData) : base(cmd, parentContext, formatData)
 {
     this.tableWriter = new TableWriter();
 }
Example #4
0
 internal TableOutputContextBase(OutCommandInner cmd, FormatMessagesContextManager.OutputContext parentContext, GroupStartData formatData) : base(cmd, parentContext, formatData)
 {
     this.tableWriter = new TableWriter();
 }