aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 6435ae6..41a1afd 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -27,10 +27,12 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Linq; 31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
33using System.Text.RegularExpressions; 34using System.Text.RegularExpressions;
35using System.Xml;
34using log4net; 36using log4net;
35using Mono.Addins; 37using Mono.Addins;
36using NDesk.Options; 38using NDesk.Options;
@@ -41,6 +43,7 @@ using OpenSim.Framework.Console;
41using OpenSim.Framework.Monitoring; 43using OpenSim.Framework.Monitoring;
42using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Region.Framework.Scenes.Serialization;
44 47
45namespace OpenSim.Region.CoreModules.World.Objects.Commands 48namespace OpenSim.Region.CoreModules.World.Objects.Commands
46{ 49{
@@ -181,6 +184,16 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
181 "Show details of scene object parts within the given area.", 184 "Show details of scene object parts within the given area.",
182 ConsoleUtil.CoordHelp, 185 ConsoleUtil.CoordHelp,
183 HandleShowPartByPos); 186 HandleShowPartByPos);
187
188 m_console.Commands.AddCommand(
189 "Objects",
190 false,
191 "dump object uuid",
192 "dump object uuid <UUID>",
193 "Dump the formatted serialization of the given object to the file <UUID>.xml",
194 "e.g. dump object uuid c1ed6809-cc24-4061-a4c2-93082a2d1f1d will dump serialization to c1ed6809-cc24-4061-a4c2-93082a2d1f1d.xml\n"
195 + "To locate the UUID in the first place, you need to use the other show object commands",
196 HandleDumpObjectByUuid);
184 } 197 }
185 198
186 public void RemoveRegion(Scene scene) 199 public void RemoveRegion(Scene scene)
@@ -447,6 +460,46 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
447 OutputSopsToConsole(searchPredicate, true); 460 OutputSopsToConsole(searchPredicate, true);
448 } 461 }
449 462
463 private void HandleDumpObjectByUuid(string module, string[] cmdparams)
464 {
465 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
466 return;
467
468 if (cmdparams.Length < 4)
469 {
470 m_console.OutputFormat("Usage: dump object uuid <uuid>");
471 return;
472 }
473
474 UUID objectUuid;
475 if (!ConsoleUtil.TryParseConsoleUuid(m_console, cmdparams[3], out objectUuid))
476 return;
477
478 SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid);
479
480 if (so == null)
481 {
482// m_console.OutputFormat("No part found with uuid {0}", objectUuid);
483 return;
484 }
485
486 string fileName = string.Format("{0}.xml", objectUuid);
487
488 if (File.Exists(fileName))
489 {
490 m_console.OutputFormat("File {0} already exists. Please move or remove it.", fileName);
491 return;
492 }
493
494 using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8))
495 {
496 xtw.Formatting = Formatting.Indented;
497 SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true);
498 }
499
500 m_console.OutputFormat("Object dumped to file {0}", fileName);
501 }
502
450 /// <summary> 503 /// <summary>
451 /// Append a scene object report to an input StringBuilder 504 /// Append a scene object report to an input StringBuilder
452 /// </summary> 505 /// </summary>