treasurechest/cli/ui/getpass.cs

21 lines
583 B
C#
Raw Permalink Normal View History

2020-05-24 08:40:51 +00:00
using System.IO;
using System;
namespace getpass{
public class GetPass{
private static StreamWriter standardOutput = new StreamWriter(Console.OpenStandardOutput());
public static string getPass(string message){
Console.Write(message + ": ");
Console.SetOut(StreamWriter.Null);
Console.SetError(StreamWriter.Null);
message = Console.ReadLine();
standardOutput.AutoFlush = true;
Console.SetOut(standardOutput);
Console.WriteLine();
return message;
}
}
}