mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-29 22:32:50 +08:00
28 lines
814 B
C#
28 lines
814 B
C#
namespace Spectre.Console.Rendering;
|
|
|
|
/// <summary>
|
|
/// Contains extension methods for <see cref="BoxBorder"/>.
|
|
/// </summary>
|
|
public static class BoxExtensions
|
|
{
|
|
/// <summary>
|
|
/// Gets the safe border for a border.
|
|
/// </summary>
|
|
/// <param name="border">The border to get the safe border for.</param>
|
|
/// <param name="safe">Whether or not to return the safe border.</param>
|
|
/// <returns>The safe border if one exist, otherwise the original border.</returns>
|
|
public static BoxBorder GetSafeBorder(this BoxBorder border, bool safe)
|
|
{
|
|
if (border is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(border));
|
|
}
|
|
|
|
if (safe && border.SafeBorder != null)
|
|
{
|
|
border = border.SafeBorder;
|
|
}
|
|
|
|
return border;
|
|
}
|
|
} |