コード例 #1
0
    /// <summary>
    /// Sets the tree guide line appearance.
    /// </summary>
    /// <param name="tree">The tree.</param>
    /// <param name="guide">The tree guide lines to use.</param>
    /// <returns>The same instance so that multiple calls can be chained.</returns>
    public static Tree Guide(this Tree tree, TreeGuide guide)
    {
        if (tree is null)
        {
            throw new ArgumentNullException(nameof(tree));
        }

        tree.Guide = guide;
        return(tree);
    }
コード例 #2
0
    /// <summary>
    /// Gets the safe border for a border.
    /// </summary>
    /// <param name="guide">The tree guide to get the safe version 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 TreeGuide GetSafeTreeGuide(this TreeGuide guide, bool safe)
    {
        if (guide is null)
        {
            throw new ArgumentNullException(nameof(guide));
        }

        if (safe && guide.SafeTreeGuide != null)
        {
            return(guide.SafeTreeGuide);
        }

        return(guide);
    }