Use file scoped namespace declarations

This commit is contained in:
Patrik Svensson
2021-12-21 11:06:46 +01:00
committed by Phil Scott
parent 1dbaf50935
commit ec1188b837
607 changed files with 28739 additions and 29245 deletions

View File

@ -1,48 +1,47 @@
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents the different parts of a box border.
/// </summary>
public enum BoxBorderPart
{
/// <summary>
/// Represents the different parts of a box border.
/// The top left part of a box.
/// </summary>
public enum BoxBorderPart
{
/// <summary>
/// The top left part of a box.
/// </summary>
TopLeft,
TopLeft,
/// <summary>
/// The top part of a box.
/// </summary>
Top,
/// <summary>
/// The top part of a box.
/// </summary>
Top,
/// <summary>
/// The top right part of a box.
/// </summary>
TopRight,
/// <summary>
/// The top right part of a box.
/// </summary>
TopRight,
/// <summary>
/// The left part of a box.
/// </summary>
Left,
/// <summary>
/// The left part of a box.
/// </summary>
Left,
/// <summary>
/// The right part of a box.
/// </summary>
Right,
/// <summary>
/// The right part of a box.
/// </summary>
Right,
/// <summary>
/// The bottom left part of a box.
/// </summary>
BottomLeft,
/// <summary>
/// The bottom left part of a box.
/// </summary>
BottomLeft,
/// <summary>
/// The bottom part of a box.
/// </summary>
Bottom,
/// <summary>
/// The bottom part of a box.
/// </summary>
Bottom,
/// <summary>
/// The bottom right part of a box.
/// </summary>
BottomRight,
}
}
/// <summary>
/// The bottom right part of a box.
/// </summary>
BottomRight,
}

View File

@ -1,27 +1,26 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents an old school ASCII border.
/// </summary>
public sealed class AsciiBoxBorder : BoxBorder
{
/// <summary>
/// Represents an old school ASCII border.
/// </summary>
public sealed class AsciiBoxBorder : BoxBorder
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
return part switch
{
return part switch
{
BoxBorderPart.TopLeft => "+",
BoxBorderPart.Top => "-",
BoxBorderPart.TopRight => "+",
BoxBorderPart.Left => "|",
BoxBorderPart.Right => "|",
BoxBorderPart.BottomLeft => "+",
BoxBorderPart.Bottom => "-",
BoxBorderPart.BottomRight => "+",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
BoxBorderPart.TopLeft => "+",
BoxBorderPart.Top => "-",
BoxBorderPart.TopRight => "+",
BoxBorderPart.Left => "|",
BoxBorderPart.Right => "|",
BoxBorderPart.BottomLeft => "+",
BoxBorderPart.Bottom => "-",
BoxBorderPart.BottomRight => "+",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,27 +1,26 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a double border.
/// </summary>
public sealed class DoubleBoxBorder : BoxBorder
{
/// <summary>
/// Represents a double border.
/// </summary>
public sealed class DoubleBoxBorder : BoxBorder
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
return part switch
{
return part switch
{
BoxBorderPart.TopLeft => "",
BoxBorderPart.Top => "",
BoxBorderPart.TopRight => "",
BoxBorderPart.Left => "",
BoxBorderPart.Right => "",
BoxBorderPart.BottomLeft => "",
BoxBorderPart.Bottom => "═",
BoxBorderPart.BottomRight => "╝",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
BoxBorderPart.TopLeft => "╔",
BoxBorderPart.Top => "═",
BoxBorderPart.TopRight => "",
BoxBorderPart.Left => "",
BoxBorderPart.Right => "",
BoxBorderPart.BottomLeft => "",
BoxBorderPart.Bottom => "",
BoxBorderPart.BottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,30 +1,29 @@
using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a heavy border.
/// </summary>
public sealed class HeavyBoxBorder : BoxBorder
{
/// <inheritdoc/>
public override BoxBorder? SafeBorder => BoxBorder.Square;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
/// <summary>
/// Represents a heavy border.
/// </summary>
public sealed class HeavyBoxBorder : BoxBorder
{
/// <inheritdoc/>
public override BoxBorder? SafeBorder => BoxBorder.Square;
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
{
return part switch
{
return part switch
{
BoxBorderPart.TopLeft => "",
BoxBorderPart.Top => "",
BoxBorderPart.TopRight => "",
BoxBorderPart.Left => "",
BoxBorderPart.Right => "",
BoxBorderPart.BottomLeft => "",
BoxBorderPart.Bottom => "━",
BoxBorderPart.BottomRight => "┛",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
BoxBorderPart.TopLeft => "┏",
BoxBorderPart.Top => "━",
BoxBorderPart.TopRight => "",
BoxBorderPart.Left => "",
BoxBorderPart.Right => "",
BoxBorderPart.BottomLeft => "",
BoxBorderPart.Bottom => "",
BoxBorderPart.BottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,14 +1,13 @@
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents an invisible border.
/// </summary>
public sealed class NoBoxBorder : BoxBorder
{
/// <summary>
/// Represents an invisible border.
/// </summary>
public sealed class NoBoxBorder : BoxBorder
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
{
return " ";
}
return " ";
}
}
}

View File

@ -1,30 +1,29 @@
using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a rounded border.
/// </summary>
public sealed class RoundedBoxBorder : BoxBorder
{
/// <inheritdoc/>
public override BoxBorder? SafeBorder => BoxBorder.Square;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
/// <summary>
/// Represents a rounded border.
/// </summary>
public sealed class RoundedBoxBorder : BoxBorder
{
/// <inheritdoc/>
public override BoxBorder? SafeBorder => BoxBorder.Square;
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
{
return part switch
{
return part switch
{
BoxBorderPart.TopLeft => "",
BoxBorderPart.Top => "",
BoxBorderPart.TopRight => "",
BoxBorderPart.Left => "",
BoxBorderPart.Right => "",
BoxBorderPart.BottomLeft => "",
BoxBorderPart.Bottom => "─",
BoxBorderPart.BottomRight => "╯",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
BoxBorderPart.TopLeft => "╭",
BoxBorderPart.Top => "─",
BoxBorderPart.TopRight => "",
BoxBorderPart.Left => "",
BoxBorderPart.Right => "",
BoxBorderPart.BottomLeft => "",
BoxBorderPart.Bottom => "",
BoxBorderPart.BottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,27 +1,26 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a square border.
/// </summary>
public sealed class SquareBoxBorder : BoxBorder
{
/// <summary>
/// Represents a square border.
/// </summary>
public sealed class SquareBoxBorder : BoxBorder
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(BoxBorderPart part)
return part switch
{
return part switch
{
BoxBorderPart.TopLeft => "",
BoxBorderPart.Top => "",
BoxBorderPart.TopRight => "",
BoxBorderPart.Left => "",
BoxBorderPart.Right => "",
BoxBorderPart.BottomLeft => "",
BoxBorderPart.Bottom => "─",
BoxBorderPart.BottomRight => "┘",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
BoxBorderPart.TopLeft => "┌",
BoxBorderPart.Top => "─",
BoxBorderPart.TopRight => "",
BoxBorderPart.Left => "",
BoxBorderPart.Right => "",
BoxBorderPart.BottomLeft => "",
BoxBorderPart.Bottom => "",
BoxBorderPart.BottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,118 +1,117 @@
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents the different parts of a table border.
/// </summary>
public enum TableBorderPart
{
/// <summary>
/// Represents the different parts of a table border.
/// The top left part of a header.
/// </summary>
public enum TableBorderPart
{
/// <summary>
/// The top left part of a header.
/// </summary>
HeaderTopLeft,
HeaderTopLeft,
/// <summary>
/// The top part of a header.
/// </summary>
HeaderTop,
/// <summary>
/// The top part of a header.
/// </summary>
HeaderTop,
/// <summary>
/// The top separator part of a header.
/// </summary>
HeaderTopSeparator,
/// <summary>
/// The top separator part of a header.
/// </summary>
HeaderTopSeparator,
/// <summary>
/// The top right part of a header.
/// </summary>
HeaderTopRight,
/// <summary>
/// The top right part of a header.
/// </summary>
HeaderTopRight,
/// <summary>
/// The left part of a header.
/// </summary>
HeaderLeft,
/// <summary>
/// The left part of a header.
/// </summary>
HeaderLeft,
/// <summary>
/// A header separator.
/// </summary>
HeaderSeparator,
/// <summary>
/// A header separator.
/// </summary>
HeaderSeparator,
/// <summary>
/// The right part of a header.
/// </summary>
HeaderRight,
/// <summary>
/// The right part of a header.
/// </summary>
HeaderRight,
/// <summary>
/// The bottom left part of a header.
/// </summary>
HeaderBottomLeft,
/// <summary>
/// The bottom left part of a header.
/// </summary>
HeaderBottomLeft,
/// <summary>
/// The bottom part of a header.
/// </summary>
HeaderBottom,
/// <summary>
/// The bottom part of a header.
/// </summary>
HeaderBottom,
/// <summary>
/// The bottom separator part of a header.
/// </summary>
HeaderBottomSeparator,
/// <summary>
/// The bottom separator part of a header.
/// </summary>
HeaderBottomSeparator,
/// <summary>
/// The bottom right part of a header.
/// </summary>
HeaderBottomRight,
/// <summary>
/// The bottom right part of a header.
/// </summary>
HeaderBottomRight,
/// <summary>
/// The top left part of a footer.
/// </summary>
FooterTopLeft,
/// <summary>
/// The top left part of a footer.
/// </summary>
FooterTopLeft,
/// <summary>
/// The top part of a footer.
/// </summary>
FooterTop,
/// <summary>
/// The top part of a footer.
/// </summary>
FooterTop,
/// <summary>
/// The top separator part of a footer.
/// </summary>
FooterTopSeparator,
/// <summary>
/// The top separator part of a footer.
/// </summary>
FooterTopSeparator,
/// <summary>
/// The top right part of a footer.
/// </summary>
FooterTopRight,
/// <summary>
/// The top right part of a footer.
/// </summary>
FooterTopRight,
/// <summary>
/// The left part of a cell.
/// </summary>
CellLeft,
/// <summary>
/// The left part of a cell.
/// </summary>
CellLeft,
/// <summary>
/// A cell separator.
/// </summary>
CellSeparator,
/// <summary>
/// A cell separator.
/// </summary>
CellSeparator,
/// <summary>
/// The right part of a cell.
/// </summary>
CellRight,
/// <summary>
/// The right part of a cell.
/// </summary>
CellRight,
/// <summary>
/// The bottom left part of a footer.
/// </summary>
FooterBottomLeft,
/// <summary>
/// The bottom left part of a footer.
/// </summary>
FooterBottomLeft,
/// <summary>
/// The bottom part of a footer.
/// </summary>
FooterBottom,
/// <summary>
/// The bottom part of a footer.
/// </summary>
FooterBottom,
/// <summary>
/// The bottom separator part of a footer.
/// </summary>
FooterBottomSeparator,
/// <summary>
/// The bottom separator part of a footer.
/// </summary>
FooterBottomSeparator,
/// <summary>
/// The bottom right part of a footer.
/// </summary>
FooterBottomRight,
}
}
/// <summary>
/// The bottom right part of a footer.
/// </summary>
FooterBottomRight,
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents another old school ASCII border.
/// </summary>
public sealed class Ascii2TableBorder : TableBorder
{
/// <summary>
/// Represents another old school ASCII border.
/// </summary>
public sealed class Ascii2TableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "+",
TableBorderPart.HeaderTop => "-",
TableBorderPart.HeaderTopSeparator => "+",
TableBorderPart.HeaderTopRight => "+",
TableBorderPart.HeaderLeft => "|",
TableBorderPart.HeaderSeparator => "|",
TableBorderPart.HeaderRight => "|",
TableBorderPart.HeaderBottomLeft => "|",
TableBorderPart.HeaderBottom => "-",
TableBorderPart.HeaderBottomSeparator => "+",
TableBorderPart.HeaderBottomRight => "|",
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "|",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "|",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "+",
TableBorderPart.FooterBottomRight => "+",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "+",
TableBorderPart.HeaderTop => "-",
TableBorderPart.HeaderTopSeparator => "+",
TableBorderPart.HeaderTopRight => "+",
TableBorderPart.HeaderLeft => "|",
TableBorderPart.HeaderSeparator => "|",
TableBorderPart.HeaderRight => "|",
TableBorderPart.HeaderBottomLeft => "|",
TableBorderPart.HeaderBottom => "-",
TableBorderPart.HeaderBottomSeparator => "+",
TableBorderPart.HeaderBottomRight => "|",
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "|",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "|",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "+",
TableBorderPart.FooterBottomRight => "+",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents an old school ASCII border with a double header border.
/// </summary>
public sealed class AsciiDoubleHeadTableBorder : TableBorder
{
/// <summary>
/// Represents an old school ASCII border with a double header border.
/// </summary>
public sealed class AsciiDoubleHeadTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "+",
TableBorderPart.HeaderTop => "-",
TableBorderPart.HeaderTopSeparator => "+",
TableBorderPart.HeaderTopRight => "+",
TableBorderPart.HeaderLeft => "|",
TableBorderPart.HeaderSeparator => "|",
TableBorderPart.HeaderRight => "|",
TableBorderPart.HeaderBottomLeft => "|",
TableBorderPart.HeaderBottom => "=",
TableBorderPart.HeaderBottomSeparator => "+",
TableBorderPart.HeaderBottomRight => "|",
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "+",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "+",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "+",
TableBorderPart.FooterBottomRight => "+",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "+",
TableBorderPart.HeaderTop => "-",
TableBorderPart.HeaderTopSeparator => "+",
TableBorderPart.HeaderTopRight => "+",
TableBorderPart.HeaderLeft => "|",
TableBorderPart.HeaderSeparator => "|",
TableBorderPart.HeaderRight => "|",
TableBorderPart.HeaderBottomLeft => "|",
TableBorderPart.HeaderBottom => "=",
TableBorderPart.HeaderBottomSeparator => "+",
TableBorderPart.HeaderBottomRight => "|",
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "+",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "+",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "+",
TableBorderPart.FooterBottomRight => "+",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents an old school ASCII border.
/// </summary>
public sealed class AsciiTableBorder : TableBorder
{
/// <summary>
/// Represents an old school ASCII border.
/// </summary>
public sealed class AsciiTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "+",
TableBorderPart.HeaderTop => "-",
TableBorderPart.HeaderTopSeparator => "-",
TableBorderPart.HeaderTopRight => "+",
TableBorderPart.HeaderLeft => "|",
TableBorderPart.HeaderSeparator => "|",
TableBorderPart.HeaderRight => "|",
TableBorderPart.HeaderBottomLeft => "|",
TableBorderPart.HeaderBottom => "-",
TableBorderPart.HeaderBottomSeparator => "+",
TableBorderPart.HeaderBottomRight => "|",
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "|",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "|",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "-",
TableBorderPart.FooterBottomRight => "+",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "+",
TableBorderPart.HeaderTop => "-",
TableBorderPart.HeaderTopSeparator => "-",
TableBorderPart.HeaderTopRight => "+",
TableBorderPart.HeaderLeft => "|",
TableBorderPart.HeaderSeparator => "|",
TableBorderPart.HeaderRight => "|",
TableBorderPart.HeaderBottomLeft => "|",
TableBorderPart.HeaderBottom => "-",
TableBorderPart.HeaderBottomSeparator => "+",
TableBorderPart.HeaderBottomRight => "|",
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => "|",
TableBorderPart.FooterTop => "-",
TableBorderPart.FooterTopSeparator => "+",
TableBorderPart.FooterTopRight => "|",
TableBorderPart.FooterBottomLeft => "+",
TableBorderPart.FooterBottom => "-",
TableBorderPart.FooterBottomSeparator => "-",
TableBorderPart.FooterBottomRight => "+",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a border with a double edge.
/// </summary>
public sealed class DoubleEdgeTableBorder : TableBorder
{
/// <summary>
/// Represents a border with a double edge.
/// </summary>
public sealed class DoubleEdgeTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "",
TableBorderPart.HeaderTop => "",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "║",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "║",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "╧",
TableBorderPart.FooterBottomRight => "╝",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "╔",
TableBorderPart.HeaderTop => "═",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "║",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "║",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "",
TableBorderPart.FooterBottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a double border.
/// </summary>
public sealed class DoubleTableBorder : TableBorder
{
/// <summary>
/// Represents a double border.
/// </summary>
public sealed class DoubleTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "",
TableBorderPart.HeaderTop => "",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "║",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "║",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "╩",
TableBorderPart.FooterBottomRight => "╝",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "╔",
TableBorderPart.HeaderTop => "═",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "║",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "║",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "",
TableBorderPart.FooterBottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,44 +1,43 @@
using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a border with a heavy edge.
/// </summary>
public sealed class HeavyEdgeTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
/// <summary>
/// Represents a border with a heavy edge.
/// </summary>
public sealed class HeavyEdgeTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "",
TableBorderPart.HeaderTop => "",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "┃",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "┃",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "┷",
TableBorderPart.FooterBottomRight => "┛",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "┏",
TableBorderPart.HeaderTop => "━",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "┃",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "┃",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "",
TableBorderPart.FooterBottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,44 +1,43 @@
using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a border with a heavy header.
/// </summary>
public sealed class HeavyHeadTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
/// <summary>
/// Represents a border with a heavy header.
/// </summary>
public sealed class HeavyHeadTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "",
TableBorderPart.HeaderTop => "",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "┃",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "│",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "┴",
TableBorderPart.FooterBottomRight => "┘",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "┏",
TableBorderPart.HeaderTop => "━",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "┃",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "│",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "",
TableBorderPart.FooterBottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,44 +1,43 @@
using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a heavy border.
/// </summary>
public sealed class HeavyTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
/// <summary>
/// Represents a heavy border.
/// </summary>
public sealed class HeavyTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "",
TableBorderPart.HeaderTop => "",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "┃",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "┃",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "┻",
TableBorderPart.FooterBottomRight => "┛",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "┏",
TableBorderPart.HeaderTop => "━",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "┃",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "┃",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "",
TableBorderPart.FooterBottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a horizontal border.
/// </summary>
public sealed class HorizontalTableBorder : TableBorder
{
/// <summary>
/// Represents a horizontal border.
/// </summary>
public sealed class HorizontalTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "─",
TableBorderPart.HeaderTop => "─",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => " ",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => "─",
TableBorderPart.HeaderBottom => "─",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "─",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "─",
TableBorderPart.FooterTopRight => "─",
TableBorderPart.FooterBottomLeft => "─",
TableBorderPart.FooterBottom => "─",
TableBorderPart.FooterBottomSeparator => "─",
TableBorderPart.FooterBottomRight => "─",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "─",
TableBorderPart.HeaderTop => "─",
TableBorderPart.HeaderTopSeparator => "─",
TableBorderPart.HeaderTopRight => "─",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => " ",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "─",
TableBorderPart.HeaderBottomRight => "─",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "─",
TableBorderPart.FooterTopRight => "─",
TableBorderPart.FooterBottomLeft => "─",
TableBorderPart.FooterBottom => "─",
TableBorderPart.FooterBottomSeparator => "─",
TableBorderPart.FooterBottomRight => "─",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -2,112 +2,111 @@ using System;
using System.Collections.Generic;
using System.Text;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a Markdown border.
/// </summary>
public sealed class MarkdownTableBorder : TableBorder
{
/// <summary>
/// Represents a Markdown border.
/// </summary>
public sealed class MarkdownTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => "|",
TableBorderPart.HeaderSeparator => "|",
TableBorderPart.HeaderRight => "|",
TableBorderPart.HeaderBottomLeft => "|",
TableBorderPart.HeaderBottom => "-",
TableBorderPart.HeaderBottomSeparator => "|",
TableBorderPart.HeaderBottomRight => "|",
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => " ",
TableBorderPart.FooterTopSeparator => " ",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
/// <inheritdoc/>
public override string GetColumnRow(TablePart part, IReadOnlyList<int> widths, IReadOnlyList<IColumn> columns)
{
if (part == TablePart.FooterSeparator)
{
return string.Empty;
}
if (part != TablePart.HeaderSeparator)
{
return base.GetColumnRow(part, widths, columns);
}
var (left, center, separator, right) = GetTableParts(part);
var builder = new StringBuilder();
builder.Append(left);
foreach (var (columnIndex, _, lastColumn, columnWidth) in widths.Enumerate())
{
var padding = columns[columnIndex].Padding;
if (padding != null && padding.Value.Left > 0)
{
// Left padding
builder.Append(" ".Repeat(padding.Value.Left));
}
var justification = columns[columnIndex].Alignment;
if (justification == null)
{
// No alignment
builder.Append(center.Repeat(columnWidth));
}
else if (justification.Value == Justify.Left)
{
// Left
builder.Append(':');
builder.Append(center.Repeat(columnWidth - 1));
}
else if (justification.Value == Justify.Center)
{
// Centered
builder.Append(':');
builder.Append(center.Repeat(columnWidth - 2));
builder.Append(':');
}
else if (justification.Value == Justify.Right)
{
// Right
builder.Append(center.Repeat(columnWidth - 1));
builder.Append(':');
}
// Right padding
if (padding != null && padding.Value.Right > 0)
{
builder.Append(" ".Repeat(padding.Value.Right));
}
if (!lastColumn)
{
builder.Append(separator);
}
}
builder.Append(right);
return builder.ToString();
}
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => "|",
TableBorderPart.HeaderSeparator => "|",
TableBorderPart.HeaderRight => "|",
TableBorderPart.HeaderBottomLeft => "|",
TableBorderPart.HeaderBottom => "-",
TableBorderPart.HeaderBottomSeparator => "|",
TableBorderPart.HeaderBottomRight => "|",
TableBorderPart.CellLeft => "|",
TableBorderPart.CellSeparator => "|",
TableBorderPart.CellRight => "|",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => " ",
TableBorderPart.FooterTopSeparator => " ",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
/// <inheritdoc/>
public override string GetColumnRow(TablePart part, IReadOnlyList<int> widths, IReadOnlyList<IColumn> columns)
{
if (part == TablePart.FooterSeparator)
{
return string.Empty;
}
if (part != TablePart.HeaderSeparator)
{
return base.GetColumnRow(part, widths, columns);
}
var (left, center, separator, right) = GetTableParts(part);
var builder = new StringBuilder();
builder.Append(left);
foreach (var (columnIndex, _, lastColumn, columnWidth) in widths.Enumerate())
{
var padding = columns[columnIndex].Padding;
if (padding != null && padding.Value.Left > 0)
{
// Left padding
builder.Append(" ".Repeat(padding.Value.Left));
}
var justification = columns[columnIndex].Alignment;
if (justification == null)
{
// No alignment
builder.Append(center.Repeat(columnWidth));
}
else if (justification.Value == Justify.Left)
{
// Left
builder.Append(':');
builder.Append(center.Repeat(columnWidth - 1));
}
else if (justification.Value == Justify.Center)
{
// Centered
builder.Append(':');
builder.Append(center.Repeat(columnWidth - 2));
builder.Append(':');
}
else if (justification.Value == Justify.Right)
{
// Right
builder.Append(center.Repeat(columnWidth - 1));
builder.Append(':');
}
// Right padding
if (padding != null && padding.Value.Right > 0)
{
builder.Append(" ".Repeat(padding.Value.Right));
}
if (!lastColumn)
{
builder.Append(separator);
}
}
builder.Append(right);
return builder.ToString();
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a minimal border with a double header border.
/// </summary>
public sealed class MinimalDoubleHeadTableBorder : TableBorder
{
/// <summary>
/// Represents a minimal border with a double header border.
/// </summary>
public sealed class MinimalDoubleHeadTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => " ",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => " ",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => " ",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => " ",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,44 +1,43 @@
using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a minimal border with a heavy header.
/// </summary>
public sealed class MinimalHeavyHeadTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Minimal;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
/// <summary>
/// Represents a minimal border with a heavy header.
/// </summary>
public sealed class MinimalHeavyHeadTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Minimal;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => " ",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => " ",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => " ",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => " ",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a minimal border.
/// </summary>
public sealed class MinimalTableBorder : TableBorder
{
/// <summary>
/// Represents a minimal border.
/// </summary>
public sealed class MinimalTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => " ",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => " ",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => " ",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => " ",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => " ",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => " ",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,17 +1,16 @@
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents an invisible border.
/// </summary>
public sealed class NoTableBorder : TableBorder
{
/// <inheritdoc/>
public override bool Visible => false;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
return " ";
}
/// <summary>
/// Represents an invisible border.
/// </summary>
public sealed class NoTableBorder : TableBorder
{
/// <inheritdoc/>
public override bool Visible => false;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
return " ";
}
}
}

View File

@ -1,44 +1,43 @@
using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a rounded border.
/// </summary>
public sealed class RoundedTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
/// <summary>
/// Represents a rounded border.
/// </summary>
public sealed class RoundedTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "",
TableBorderPart.HeaderTop => "",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "│",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "│",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "┴",
TableBorderPart.FooterBottomRight => "╯",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "╭",
TableBorderPart.HeaderTop => "─",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "│",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "│",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "",
TableBorderPart.FooterBottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,44 +1,43 @@
using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a simple border with heavy lines.
/// </summary>
public sealed class SimpleHeavyTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Simple;
namespace Spectre.Console.Rendering;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
/// <summary>
/// Represents a simple border with heavy lines.
/// </summary>
public sealed class SimpleHeavyTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Simple;
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => " ",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => "━",
TableBorderPart.HeaderBottom => "━",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "━",
TableBorderPart.FooterTop => "━",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => " ",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "━",
TableBorderPart.HeaderBottomRight => "━",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "━",
TableBorderPart.FooterTopRight => "━",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a simple border.
/// </summary>
public sealed class SimpleTableBorder : TableBorder
{
/// <summary>
/// Represents a simple border.
/// </summary>
public sealed class SimpleTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => " ",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => "─",
TableBorderPart.HeaderBottom => "─",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "─",
TableBorderPart.FooterTop => "─",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => " ",
TableBorderPart.HeaderTop => " ",
TableBorderPart.HeaderTopSeparator => " ",
TableBorderPart.HeaderTopRight => " ",
TableBorderPart.HeaderLeft => " ",
TableBorderPart.HeaderSeparator => " ",
TableBorderPart.HeaderRight => " ",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "─",
TableBorderPart.HeaderBottomRight => "─",
TableBorderPart.CellLeft => " ",
TableBorderPart.CellSeparator => " ",
TableBorderPart.CellRight => " ",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "─",
TableBorderPart.FooterTopRight => "─",
TableBorderPart.FooterBottomLeft => " ",
TableBorderPart.FooterBottom => " ",
TableBorderPart.FooterBottomSeparator => " ",
TableBorderPart.FooterBottomRight => " ",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}

View File

@ -1,41 +1,40 @@
using System;
namespace Spectre.Console.Rendering
namespace Spectre.Console.Rendering;
/// <summary>
/// Represents a square border.
/// </summary>
public sealed class SquareTableBorder : TableBorder
{
/// <summary>
/// Represents a square border.
/// </summary>
public sealed class SquareTableBorder : TableBorder
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
{
/// <inheritdoc/>
public override string GetPart(TableBorderPart part)
return part switch
{
return part switch
{
TableBorderPart.HeaderTopLeft => "",
TableBorderPart.HeaderTop => "",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "│",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "│",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "┴",
TableBorderPart.FooterBottomRight => "┘",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
TableBorderPart.HeaderTopLeft => "┌",
TableBorderPart.HeaderTop => "─",
TableBorderPart.HeaderTopSeparator => "",
TableBorderPart.HeaderTopRight => "",
TableBorderPart.HeaderLeft => "",
TableBorderPart.HeaderSeparator => "",
TableBorderPart.HeaderRight => "│",
TableBorderPart.HeaderBottomLeft => "",
TableBorderPart.HeaderBottom => "",
TableBorderPart.HeaderBottomSeparator => "",
TableBorderPart.HeaderBottomRight => "",
TableBorderPart.CellLeft => "",
TableBorderPart.CellSeparator => "",
TableBorderPart.CellRight => "│",
TableBorderPart.FooterTopLeft => "",
TableBorderPart.FooterTop => "",
TableBorderPart.FooterTopSeparator => "",
TableBorderPart.FooterTopRight => "",
TableBorderPart.FooterBottomLeft => "",
TableBorderPart.FooterBottom => "",
TableBorderPart.FooterBottomSeparator => "",
TableBorderPart.FooterBottomRight => "",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}