From aa497a18678c6cc9a7425986c5bf5ca91415bd1d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 19 Dec 2008 19:47:11 +0000 Subject: * refactor: move saved named prims to xml2 method out into the serialization module --- .../Modules/World/Serialiser/SceneXmlLoader.cs | 29 +++++++++++++++++++--- .../Modules/World/Serialiser/SerialiserModule.cs | 5 ++++ 2 files changed, 31 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/World') diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index c856b5b..2e9c551 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs @@ -28,10 +28,10 @@ using System; using System.Collections.Generic; using System.IO; -//using System.Reflection; +using System.Reflection; using System.Xml; using OpenMetaverse; -//using log4net; +using log4net; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; @@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes /// public class SceneXmlLoader { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) { @@ -213,6 +213,29 @@ namespace OpenSim.Region.Environment.Scenes SavePrimListToXml2(EntityList, stream, min, max); } + + public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) + { + m_log.InfoFormat( + "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", + primName, scene.RegionInfo.RegionName, fileName); + + List entityList = scene.GetEntities(); + List primList = new List(); + + foreach (EntityBase ent in entityList) + { + if (ent is SceneObjectGroup) + { + if (ent.Name == primName) + { + primList.Add(ent); + } + } + } + + SavePrimListToXml2(primList, fileName); + } public static void SavePrimListToXml2(List entityList, string fileName) { diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs index 8b5dd2c..c1af947 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs @@ -116,6 +116,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser { SceneXmlLoader.SavePrimsToXml2(scene, stream, min, max); } + + public void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) + { + SceneXmlLoader.SaveNamedPrimsToXml2(scene, primName, fileName); + } public SceneObjectGroup DeserializeGroupFromXml2(string xmlString) { -- cgit v1.1