| | | 1 | | namespace Kestrun.Logging.Utils.Console; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents padding values for left and right sides, and provides methods to generate padding strings. |
| | | 5 | | /// </summary> |
| | | 6 | | public class Padding |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Gets or sets the padding value for the right side. |
| | | 10 | | /// </summary> |
| | 60 | 11 | | public int Right { get; set; } |
| | | 12 | | /// <summary> |
| | | 13 | | /// Gets or sets the padding value for the left side. |
| | | 14 | | /// </summary> |
| | 60 | 15 | | public int Left { get; set; } |
| | | 16 | | |
| | | 17 | | /// <summary> |
| | | 18 | | /// Initializes a new instance of the <see cref="Padding"/> class with the same padding value for both left and righ |
| | | 19 | | /// </summary> |
| | | 20 | | /// <param name="all">The padding value to apply to both left and right sides.</param> |
| | 12 | 21 | | public Padding(int all) => Right = Left = all; |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Initializes a new instance of the <see cref="Padding"/> class with specified right and left padding values. |
| | | 25 | | /// </summary> |
| | | 26 | | /// <param name="right">The padding value for the right side.</param> |
| | | 27 | | /// <param name="left">The padding value for the left side.</param> |
| | 0 | 28 | | public Padding(int right, int left) |
| | | 29 | | { |
| | 0 | 30 | | Right = right; |
| | 0 | 31 | | Left = left; |
| | 0 | 32 | | } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Returns a string consisting of spaces for the right padding. |
| | | 36 | | /// </summary> |
| | 26 | 37 | | public string RightString() => PadString(Right); |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Returns a string consisting of spaces for the left padding. |
| | | 41 | | /// </summary> |
| | 26 | 42 | | public string LeftString() => PadString(Left); |
| | | 43 | | |
| | 52 | 44 | | private static string PadString(int padding) => string.Concat(Enumerable.Repeat(' ', padding)); |
| | | 45 | | } |