aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ConsoleClient
diff options
context:
space:
mode:
authorDiva Canto2010-06-08 15:52:56 -0700
committerDiva Canto2010-06-08 15:52:56 -0700
commit0520b629558ac896698807e97e2185c5a7b7a186 (patch)
tree1565bbe76f1eb9ae7a9fb997231339ad5b55209f /OpenSim/ConsoleClient
parentChanged XInventoryData's CreatorID to a string. (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-0520b629558ac896698807e97e2185c5a7b7a186.zip
opensim-SC-0520b629558ac896698807e97e2185c5a7b7a186.tar.gz
opensim-SC-0520b629558ac896698807e97e2185c5a7b7a186.tar.bz2
opensim-SC-0520b629558ac896698807e97e2185c5a7b7a186.tar.xz
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/ConsoleClient')
-rw-r--r--OpenSim/ConsoleClient/ConsoleClient.cs38
1 files changed, 30 insertions, 8 deletions
diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs
index 8c616e0..f4605da 100644
--- a/OpenSim/ConsoleClient/ConsoleClient.cs
+++ b/OpenSim/ConsoleClient/ConsoleClient.cs
@@ -29,6 +29,7 @@ using Nini.Config;
29using log4net; 29using log4net;
30using System.Reflection; 30using System.Reflection;
31using System; 31using System;
32using System.IO;
32using System.Xml; 33using System.Xml;
33using System.Collections.Generic; 34using System.Collections.Generic;
34using OpenSim.Server.Base; 35using OpenSim.Server.Base;
@@ -73,9 +74,18 @@ namespace OpenSim.ConsoleClient
73 74
74 Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/StartSession/", String.Format("USER={0}&PASS={1}", m_User, m_Pass), LoginReply); 75 Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/StartSession/", String.Format("USER={0}&PASS={1}", m_User, m_Pass), LoginReply);
75 76
76 int res = m_Server.Run(); 77 string pidFile = serverConfig.GetString("PIDFile", String.Empty);
77 78
78 Environment.Exit(res); 79 while (m_Server.Running)
80 {
81 System.Threading.Thread.Sleep(500);
82 // MainConsole.Instance.Prompt();
83 }
84
85 if (pidFile != String.Empty)
86 File.Delete(pidFile);
87
88 Environment.Exit(0);
79 89
80 return 0; 90 return 0;
81 } 91 }
@@ -83,13 +93,14 @@ namespace OpenSim.ConsoleClient
83 private static void SendCommand(string module, string[] cmd) 93 private static void SendCommand(string module, string[] cmd)
84 { 94 {
85 string sendCmd = ""; 95 string sendCmd = "";
96 string[] cmdlist = new string[cmd.Length - 1];
97
98 sendCmd = cmd[0];
99
86 if (cmd.Length > 1) 100 if (cmd.Length > 1)
87 { 101 {
88 sendCmd = cmd[0]; 102 Array.Copy(cmd, 1, cmdlist, 0, cmd.Length - 1);
89 103 sendCmd += " \"" + String.Join("\" \"", cmdlist) + "\"";
90 Array.Copy(cmd, 1, cmd, 0, cmd.Length-1);
91 Array.Resize(ref cmd, cmd.Length-1);
92 sendCmd += "\"" + String.Join("\" \"", cmd) + "\"";
93 } 104 }
94 105
95 Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply); 106 Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply);
@@ -183,16 +194,27 @@ namespace OpenSim.ConsoleClient
183 while (lines.Count > 100) 194 while (lines.Count > 100)
184 lines.RemoveAt(0); 195 lines.RemoveAt(0);
185 196
197 string prompt = String.Empty;
198
186 foreach (string l in lines) 199 foreach (string l in lines)
187 { 200 {
188 string[] parts = l.Split(new char[] {':'}, 3); 201 string[] parts = l.Split(new char[] {':'}, 3);
189 if (parts.Length != 3) 202 if (parts.Length != 3)
190 continue; 203 continue;
191 204
192 MainConsole.Instance.Output(parts[2].Trim(), parts[1]); 205 if (parts[2].StartsWith("+++") || parts[2].StartsWith("-++"))
206 prompt = parts[2];
207 else
208 MainConsole.Instance.Output(parts[2].Trim(), parts[1]);
193 } 209 }
194 210
211
195 Requester.MakeRequest(requestUrl, requestData, ReadResponses); 212 Requester.MakeRequest(requestUrl, requestData, ReadResponses);
213
214 if (prompt.StartsWith("+++"))
215 MainConsole.Instance.ReadLine(prompt.Substring(3), true, true);
216 else if (prompt.StartsWith("-++"))
217 SendCommand(String.Empty, new string[] { MainConsole.Instance.ReadLine(prompt.Substring(3), false, true) });
196 } 218 }
197 219
198 public static void CommandReply(string requestUrl, string requestData, string replyData) 220 public static void CommandReply(string requestUrl, string requestData, string replyData)