From be6080c3c822707d152ccecc2e6fbe83ca1d5ba5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 24 Oct 2019 17:07:59 +0100 Subject: partial revert console Prompt code to fix it --- OpenSim/Framework/Console/ConsoleBase.cs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Console/ConsoleBase.cs') diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index f9dfb63..75dbe11 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -121,17 +121,38 @@ namespace OpenSim.Framework.Console public string Prompt(string p) { - return Prompt(p, null, null, true); + return ReadLine(String.Format("{0}: ", p), false, true); } public string Prompt(string p, string def) { - return Prompt(p, def, null, true); + string ret = ReadLine(String.Format("{0} [{1}]: ", p, def), false, true); + if (ret == String.Empty) + ret = def; + + return ret; } public string Prompt(string p, List excludedCharacters) { - return Prompt(p, null, excludedCharacters, true); + bool itisdone = false; + string ret = String.Empty; + while (!itisdone) + { + itisdone = true; + ret = Prompt(p); + + foreach (char c in excludedCharacters) + { + if (ret.Contains(c.ToString())) + { + System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted."); + itisdone = false; + } + } + } + + return ret; } public virtual string Prompt(string p, string def, List excludedCharacters, bool echo = true) @@ -142,6 +163,8 @@ namespace OpenSim.Framework.Console { itisdone = true; + ret = Prompt(p, def); + if (def != null) ret = ReadLine(String.Format("{0}: ", p), false, echo); else -- cgit v1.1