* refactor: move saved named prims to xml2 method out into the serialization module
parent
e62016d2c7
commit
aa497a1867
|
@ -103,6 +103,8 @@ namespace OpenSim.Region.Environment.Interfaces
|
|||
/// <param name="max"></param>
|
||||
void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max);
|
||||
|
||||
void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName);
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a scene object from its xml2 representation. This does not load the object into the scene.
|
||||
/// </summary>
|
||||
|
|
|
@ -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
|
|||
/// </summary>
|
||||
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)
|
||||
{
|
||||
|
@ -214,6 +214,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<EntityBase> entityList = scene.GetEntities();
|
||||
List<EntityBase> primList = new List<EntityBase>();
|
||||
|
||||
foreach (EntityBase ent in entityList)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
if (ent.Name == primName)
|
||||
{
|
||||
primList.Add(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SavePrimListToXml2(primList, fileName);
|
||||
}
|
||||
|
||||
public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
|
||||
{
|
||||
FileStream file = new FileStream(fileName, FileMode.Create);
|
||||
|
|
|
@ -117,6 +117,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)
|
||||
{
|
||||
return SceneXmlLoader.DeserializeGroupFromXml2(xmlString);
|
||||
|
|
|
@ -1880,28 +1880,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return false;
|
||||
}
|
||||
|
||||
public void SaveNamedPrimsToXml2(string primName, string fileName)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[SCENE]: Saving prims with name {0} in xml2 format for region {1} to {2}", primName, RegionInfo.RegionName, fileName);
|
||||
|
||||
List<EntityBase> entityList = GetEntities();
|
||||
List<EntityBase> primList = new List<EntityBase>();
|
||||
|
||||
foreach (EntityBase ent in entityList)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
if (ent.Name == primName)
|
||||
{
|
||||
primList.Add(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_serialiser.SavePrimListToXml2(primList, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move the given scene object into a new region depending on which region its absolute position has moved
|
||||
/// into.
|
||||
|
|
|
@ -215,7 +215,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public void SaveNamedPrimsToXml2(string primName, string filename)
|
||||
{
|
||||
CurrentOrFirstScene.SaveNamedPrimsToXml2( primName, filename);
|
||||
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
serialiser.SaveNamedPrimsToXml2(CurrentOrFirstScene, primName, filename);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue