mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 18:40:50 +08:00 
			
		
		
		
	fixed line-endings
This commit is contained in:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							989c0b9904
						
					
				
				
					commit
					44300c871f
				
			@@ -60,7 +60,7 @@ public static partial class AnsiConsoleExtensions
 | 
			
		||||
 | 
			
		||||
            if (!char.IsControl(key.KeyChar))
 | 
			
		||||
            {
 | 
			
		||||
                text += key.KeyChar.ToString();
 | 
			
		||||
                text += key.KeyChar.ToString();
 | 
			
		||||
                var output = key.KeyChar.ToString();
 | 
			
		||||
                console.Write(secret ? output.Mask(mask) : output, style);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -185,28 +185,28 @@ public static class StringExtensions
 | 
			
		||||
#else
 | 
			
		||||
        return text.Contains(value, StringComparison.Ordinal);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// "Masks" every character in a string.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <param name="value">String value to mask.</param>
 | 
			
		||||
    /// <param name="mask">Character to use for masking.</param>
 | 
			
		||||
    /// <returns>Masked string.</returns>
 | 
			
		||||
    public static string Mask(this string value, char? mask)
 | 
			
		||||
    {
 | 
			
		||||
        var output = string.Empty;
 | 
			
		||||
 | 
			
		||||
        if (mask is null)
 | 
			
		||||
        {
 | 
			
		||||
            return output;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach (var c in value)
 | 
			
		||||
        {
 | 
			
		||||
            output += mask;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return output;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// "Masks" every character in a string.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <param name="value">String value to mask.</param>
 | 
			
		||||
    /// <param name="mask">Character to use for masking.</param>
 | 
			
		||||
    /// <returns>Masked string.</returns>
 | 
			
		||||
    public static string Mask(this string value, char? mask)
 | 
			
		||||
    {
 | 
			
		||||
        var output = string.Empty;
 | 
			
		||||
 | 
			
		||||
        if (mask is null)
 | 
			
		||||
        {
 | 
			
		||||
            return output;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach (var c in value)
 | 
			
		||||
        {
 | 
			
		||||
            output += mask;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return output;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace Spectre.Console;
 | 
			
		||||
namespace Spectre.Console;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Represents horizontal alignment.
 | 
			
		||||
 
 | 
			
		||||
@@ -286,25 +286,25 @@ public static class TextPromptExtensions
 | 
			
		||||
 | 
			
		||||
        obj.IsSecret = true;
 | 
			
		||||
        return obj;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Replaces prompt user input with mask in the console.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <typeparam name="T">The prompt type.</typeparam>
 | 
			
		||||
    /// <param name="obj">The prompt.</param>
 | 
			
		||||
    /// <param name="obj">The prompt.</param>
 | 
			
		||||
    /// <param name="mask">The masking character to use for the secret.</param>
 | 
			
		||||
    /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
    public static TextPrompt<T> Secret<T>(this TextPrompt<T> obj, char? mask)
 | 
			
		||||
    {
 | 
			
		||||
        if (obj is null)
 | 
			
		||||
        {
 | 
			
		||||
            throw new ArgumentNullException(nameof(obj));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        obj.IsSecret = true;
 | 
			
		||||
        obj.Mask = mask;
 | 
			
		||||
        return obj;
 | 
			
		||||
    /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
    public static TextPrompt<T> Secret<T>(this TextPrompt<T> obj, char? mask)
 | 
			
		||||
    {
 | 
			
		||||
        if (obj is null)
 | 
			
		||||
        {
 | 
			
		||||
            throw new ArgumentNullException(nameof(obj));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        obj.IsSecret = true;
 | 
			
		||||
        obj.Mask = mask;
 | 
			
		||||
        return obj;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace Spectre.Console;
 | 
			
		||||
namespace Spectre.Console;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
/// Represents vertical alignment.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace Spectre.Console;
 | 
			
		||||
namespace Spectre.Console;
 | 
			
		||||
 | 
			
		||||
internal static class TypeNameHelper
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace Spectre.Console;
 | 
			
		||||
namespace Spectre.Console;
 | 
			
		||||
 | 
			
		||||
[DebuggerDisplay("{Region,nq}")]
 | 
			
		||||
internal sealed class LayoutRender
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user