aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base/ServicesServerBase.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-11-22 05:57:20 +0000
committerJustin Clark-Casey (justincc)2012-11-22 05:57:20 +0000
commit3ce00e97cc6a7801738e72af8b8033fd81d09d12 (patch)
treeb4b65c59375af3b4e2bbedb83153bb6bda2558e3 /OpenSim/Server/Base/ServicesServerBase.cs
parentMake "config show/set/get/save" console commands available on all servers (diff)
downloadopensim-SC_OLD-3ce00e97cc6a7801738e72af8b8033fd81d09d12.zip
opensim-SC_OLD-3ce00e97cc6a7801738e72af8b8033fd81d09d12.tar.gz
opensim-SC_OLD-3ce00e97cc6a7801738e72af8b8033fd81d09d12.tar.bz2
opensim-SC_OLD-3ce00e97cc6a7801738e72af8b8033fd81d09d12.tar.xz
Factor out command script code.
This also allows comments in command scripts (lines starting with ;, # or //) to be used across all servers
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs39
1 files changed, 0 insertions, 39 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 2c2b8ed..5b23149 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -196,11 +196,6 @@ namespace OpenSim.Server.Base
196 MainConsole.Instance.Commands.AddCommand("General", false, "shutdown", 196 MainConsole.Instance.Commands.AddCommand("General", false, "shutdown",
197 "shutdown", 197 "shutdown",
198 "Quit the application", HandleQuit); 198 "Quit the application", HandleQuit);
199
200 // Register a command to read other commands from a file
201 MainConsole.Instance.Commands.AddCommand("General", false, "command-script",
202 "command-script <script>",
203 "Run a command script from file", HandleScript);
204 199
205 // Allow derived classes to perform initialization that 200 // Allow derived classes to perform initialization that
206 // needs to be done after the console has opened 201 // needs to be done after the console has opened
@@ -239,40 +234,6 @@ namespace OpenSim.Server.Base
239 234
240 } 235 }
241 236
242 protected virtual void HandleScript(string module, string[] parms)
243 {
244 if (parms.Length != 2)
245 {
246 return;
247 }
248 RunCommandScript(parms[1]);
249 }
250
251 /// <summary>
252 /// Run an optional startup list of commands
253 /// </summary>
254 /// <param name="fileName"></param>
255 private void RunCommandScript(string fileName)
256 {
257 if (File.Exists(fileName))
258 {
259 m_log.Info("[COMMANDFILE]: Running " + fileName);
260
261 using (StreamReader readFile = File.OpenText(fileName))
262 {
263 string currentCommand;
264 while ((currentCommand = readFile.ReadLine()) != null)
265 {
266 if (currentCommand != String.Empty)
267 {
268 m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
269 MainConsole.Instance.RunCommand(currentCommand);
270 }
271 }
272 }
273 }
274 }
275
276 protected virtual void ReadConfig() 237 protected virtual void ReadConfig()
277 { 238 {
278 } 239 }