partial revert console Prompt code to fix it

0.9.1.0-post-fixes
UbitUmarov 2019-10-24 17:07:59 +01:00
parent 46e36601cb
commit be6080c3c8
1 changed files with 26 additions and 3 deletions

View File

@ -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<char> 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<char> 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