aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console/ConsoleBase.cs
diff options
context:
space:
mode:
authorCharles Krinke2008-04-23 14:31:54 +0000
committerCharles Krinke2008-04-23 14:31:54 +0000
commit67f2b89bf6f6d071c61c313cc900cfc375b185d4 (patch)
tree15093546aa56fe04fa14b617de3551c34a4e8736 /OpenSim/Framework/Console/ConsoleBase.cs
parent* Patch for #973 - Object Rez from Inventory ignores permissions - Thanks tgl... (diff)
downloadopensim-SC-67f2b89bf6f6d071c61c313cc900cfc375b185d4.zip
opensim-SC-67f2b89bf6f6d071c61c313cc900cfc375b185d4.tar.gz
opensim-SC-67f2b89bf6f6d071c61c313cc900cfc375b185d4.tar.bz2
opensim-SC-67f2b89bf6f6d071c61c313cc900cfc375b185d4.tar.xz
Thank you kindly, Tyre for :
Commands with arguments enclosed in Double quotation marks (e.g. filenames or objects with embedded blanks) should be parsed correctly. e.g.: console command "edit-scale" don't accept prim names with embedded blanks edit-scale Prim 20x20x20 20 20 20 Region# : edit-scale "Prim 20x20x20" 20 20 20 Region# : edit-scale Prim20x20x20 20 20 20 Searching for Primitive: 'Prim20x20x20' Edited scale of Primitive: Prim20x20x20 Region# :
Diffstat (limited to 'OpenSim/Framework/Console/ConsoleBase.cs')
-rw-r--r--OpenSim/Framework/Console/ConsoleBase.cs26
1 files changed, 16 insertions, 10 deletions
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index 27ff340..1d92ed1 100644
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -26,7 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text.RegularExpressions;
30using System.Diagnostics; 32using System.Diagnostics;
31using System.Net; 33using System.Net;
32using System.Reflection; 34using System.Reflection;
@@ -368,23 +370,27 @@ namespace OpenSim.Framework.Console
368 RunCommand(tempstr); 370 RunCommand(tempstr);
369 } 371 }
370 372
371 public void RunCommand(string command) 373 public void RunCommand(string cmdline)
372 { 374 {
373 string[] tempstrarray; 375 Regex Extractor = new Regex(@"(['""][^""]+['""])\s*|([^\s]+)\s*", RegexOptions.Compiled);
374 tempstrarray = command.Split(' '); 376 char[] delims = {' ', '"'};
375 string cmd = tempstrarray[0]; 377 MatchCollection matches = Extractor.Matches(cmdline);
376 Array.Reverse(tempstrarray); 378 // Get matches
377 Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); 379 string cmd = matches[0].Value.Trim(delims);
378 Array.Reverse(tempstrarray); 380 string[] cmdparams = new string[matches.Count - 1];
379 string[] cmdparams = (string[]) tempstrarray; 381
380 382 for (int i = 1; i < matches.Count; i++)
383 {
384 cmdparams[i-1] = matches[i].Value.Trim(delims);
385 }
386
381 try 387 try
382 { 388 {
383 RunCmd(cmd, cmdparams); 389 RunCmd(cmd, cmdparams);
384 } 390 }
385 catch (Exception e) 391 catch (Exception e)
386 { 392 {
387 m_log.ErrorFormat("[Console]: Command [{0}] failed with exception {1}", command, e.ToString()); 393 m_log.ErrorFormat("[Console]: Command [{0}] failed with exception {1}", cmdline, e.ToString());
388 } 394 }
389 } 395 }
390 396