29 using System.Collections.Generic;
30 using System.Diagnostics;
31 using System.Reflection;
33 using System.Threading;
36 namespace OpenSim.Framework.Console
42 protected string prompt =
"# ";
44 public object ConsoleScene {
get; set; }
46 public string DefaultPrompt {
get; set; }
50 DefaultPrompt = defaultPrompt;
61 public virtual void Output(
string text,
string level)
66 public virtual void Output(
string text)
68 System.Console.WriteLine(text);
73 Output(
string.Format(format, components));
78 return ReadLine(String.Format(
"{0}: ", p),
false,
true);
83 string ret = ReadLine(String.Format(
"{0} [{1}]: ", p, def),
false,
true);
84 if (ret == String.Empty)
90 public string CmdPrompt(
string p, List<char> excludedCharacters)
92 bool itisdone =
false;
93 string ret = String.Empty;
99 foreach (
char c
in excludedCharacters)
101 if (ret.Contains(c.ToString()))
103 System.Console.WriteLine(
"The character \"" + c.ToString() +
"\" is not permitted.");
112 public string CmdPrompt(
string p,
string def, List<char> excludedCharacters)
114 bool itisdone =
false;
115 string ret = String.Empty;
119 ret = CmdPrompt(p, def);
121 if (ret == String.Empty)
127 foreach (
char c
in excludedCharacters)
129 if (ret.Contains(c.ToString()))
131 System.Console.WriteLine(
"The character \"" + c.ToString() +
"\" is not permitted.");
144 bool itisdone =
false;
145 string optstr = String.Empty;
149 string temp = CmdPrompt(prompt, defaultresponse);
150 while (itisdone ==
false)
152 if (options.Contains(temp))
158 System.Console.WriteLine(
"Valid options are" + optstr);
159 temp = CmdPrompt(prompt, defaultresponse);
169 return ReadLine(String.Format(
"{0}: ", p),
false,
false);
172 public virtual string ReadLine(
string p,
bool isCommand,
bool e)
174 System.Console.Write(
"{0}", p);
175 string cmdinput = System.Console.ReadLine();
string CmdPrompt(string p)
ConsoleBase(string defaultPrompt)
string CmdPrompt(string p, string def, List< char > excludedCharacters)
string CmdPrompt(string prompt, string defaultresponse, List< string > options)
string CmdPrompt(string p, string def)
virtual void LockOutput()
virtual void OutputFormat(string format, params object[] components)
virtual void Output(string text)
virtual string ReadLine(string p, bool isCommand, bool e)
virtual void UnlockOutput()
virtual void Output(string text, string level)
string CmdPrompt(string p, List< char > excludedCharacters)
string PasswdPrompt(string p)