diff options
author | Melanie Thielker | 2009-05-20 20:28:57 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-05-20 20:28:57 +0000 |
commit | 787d58ae7f160960fda606be1852c8ed6a9e3893 (patch) | |
tree | 7ba063ac8c794801e870ffd1c14dfb1ed47bb1dd /OpenSim/Framework/Console | |
parent | Comment out the asset cache config in .ini.example. (diff) | |
download | opensim-SC-787d58ae7f160960fda606be1852c8ed6a9e3893.zip opensim-SC-787d58ae7f160960fda606be1852c8ed6a9e3893.tar.gz opensim-SC-787d58ae7f160960fda606be1852c8ed6a9e3893.tar.bz2 opensim-SC-787d58ae7f160960fda606be1852c8ed6a9e3893.tar.xz |
Put some meat on the bones of the REST console. NO user functionality yet
Diffstat (limited to 'OpenSim/Framework/Console')
-rw-r--r-- | OpenSim/Framework/Console/RemoteConsole.cs | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index fdbf1f4..88d385e 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs | |||
@@ -46,6 +46,10 @@ namespace OpenSim.Framework.Console | |||
46 | private IHttpServer m_Server = null; | 46 | private IHttpServer m_Server = null; |
47 | private IConfigSource m_Config = null; | 47 | private IConfigSource m_Config = null; |
48 | 48 | ||
49 | private List<string> m_Scrollback = new List<string>(); | ||
50 | private ManualResetEvent m_DataEvent = new ManualResetEvent(false); | ||
51 | private List<string> m_InputData = new List<string>(); | ||
52 | |||
49 | public RemoteConsole(string defaultPrompt) : base(defaultPrompt) | 53 | public RemoteConsole(string defaultPrompt) : base(defaultPrompt) |
50 | { | 54 | { |
51 | } | 55 | } |
@@ -62,12 +66,52 @@ namespace OpenSim.Framework.Console | |||
62 | 66 | ||
63 | public override void Output(string text, string level) | 67 | public override void Output(string text, string level) |
64 | { | 68 | { |
69 | lock (m_Scrollback) | ||
70 | { | ||
71 | while (m_Scrollback.Count >= 1000) | ||
72 | m_Scrollback.RemoveAt(0); | ||
73 | m_Scrollback.Add(level+":"+text); | ||
74 | } | ||
65 | System.Console.Write(text); | 75 | System.Console.Write(text); |
66 | } | 76 | } |
67 | 77 | ||
68 | public override string ReadLine(string p, bool isCommand, bool e) | 78 | public override string ReadLine(string p, bool isCommand, bool e) |
69 | { | 79 | { |
70 | return String.Empty; | 80 | System.Console.Write("{0}", prompt); |
81 | |||
82 | m_DataEvent.WaitOne(); | ||
83 | |||
84 | lock(m_InputData) | ||
85 | { | ||
86 | if (m_InputData.Count == 0) | ||
87 | { | ||
88 | m_DataEvent.Reset(); | ||
89 | return ""; | ||
90 | } | ||
91 | |||
92 | string cmdinput = m_InputData[0]; | ||
93 | m_InputData.RemoveAt(0); | ||
94 | if (m_InputData.Count == 0) | ||
95 | m_DataEvent.Reset(); | ||
96 | |||
97 | if (isCommand) | ||
98 | { | ||
99 | string[] cmd = Commands.Resolve(Parser.Parse(cmdinput)); | ||
100 | |||
101 | if (cmd.Length != 0) | ||
102 | { | ||
103 | int i; | ||
104 | |||
105 | for (i=0 ; i < cmd.Length ; i++) | ||
106 | { | ||
107 | if (cmd[i].Contains(" ")) | ||
108 | cmd[i] = "\"" + cmd[i] + "\""; | ||
109 | } | ||
110 | return String.Empty; | ||
111 | } | ||
112 | } | ||
113 | return cmdinput; | ||
114 | } | ||
71 | } | 115 | } |
72 | } | 116 | } |
73 | } | 117 | } |