コード例 #1
0
        private void WriteValueWithPadding(
            IColoredTextWriter textWriter,
            MessageTemplate.ArgumentToken arg,
            string formatedValue,
            Color?textForegroud,
            Color?textBackground,
            Color?valueForeground,
            Color?valueBackground)
        {
            if (arg.Alignment > 0)
            {
                int padLeft = arg.Alignment - formatedValue.Length;
                textWriter.Write(textForegroud, textBackground, ' ', padLeft);
            }

            textWriter.Write(
                valueForeground ?? textForegroud,
                valueBackground ?? textBackground,
                formatedValue);

            if (arg.Alignment < 0)
            {
                int padRight = -arg.Alignment - formatedValue.Length;
                textWriter.Write(textForegroud, textBackground, ' ', padRight);
            }
        }
コード例 #2
0
        private void WriteValueWithPadding(
            ITextWriter textWriter,
            MessageTemplate.ArgumentToken arg,
            string formatedValue)
        {
            if (arg.Alignment > 0)
            {
                int padLeft = arg.Alignment - formatedValue.Length;
                textWriter.Write(' ', padLeft);
            }

            textWriter.Write(formatedValue);

            if (arg.Alignment < 0)
            {
                int padRight = -arg.Alignment - formatedValue.Length;
                textWriter.Write(' ', padRight);
            }
        }