* refactor: Making some of the serialization names consistent, both within their pairings and with the others

* This does make some of the names less ideal than others - this should change in the future
0.6.0-stable
Justin Clarke Casey 2008-06-21 21:20:59 +00:00
parent 91ffb6722f
commit 908d91be78
5 changed files with 54 additions and 23 deletions

View File

@ -99,24 +99,28 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
} }
// Reload serialized prims // Reload serialized prims
m_log.InfoFormat("[ARCHIVER]: Loading prim data"); m_log.InfoFormat("[ARCHIVER]: Loading scene objects");
IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>(); IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
// Temporary code to read each sog in the file separately, pending actually having these in separate files // Temporary code to read each sog in the file separately, pending actually having these in separate files
// XmlTextReader xtr = new XmlTextReader(new StringReader(serializedPrims)); XmlTextReader xtr = new XmlTextReader(new StringReader(serializedPrims));
// XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
// reader.WhitespaceHandling = WhitespaceHandling.None; xtr.WhitespaceHandling = WhitespaceHandling.None;
// doc.Load(xtr); doc.Load(xtr);
// xtr.Close(); xtr.Close();
// XmlNode sceneNode = doc.FirstChild; XmlNode sceneNode = doc.FirstChild;
// int count = 0;
// foreach (XmlNode objectNode in sceneNode.ChildNodes)
// {
// CreatePrimFromXml2(m_scene, objectNode.OuterXml);
// }
serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims)); foreach (XmlNode objectNode in sceneNode.ChildNodes)
{
serialiser.LoadGroupFromXml2(m_scene, objectNode.OuterXml.ToString());
count++;
}
//serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims));
m_log.DebugFormat("[ARCHIVER]: Loaded {0} scene objects", count);
} }
} }
} }

View File

@ -36,8 +36,20 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{ {
List<string> SerialiseRegion(Scene scene, string saveDir); List<string> SerialiseRegion(Scene scene, string saveDir);
/// <summary>
/// Load prims from the xml format
/// </summary>
/// <param name="scene"></param>
/// <param name="fileName"></param>
/// <param name="newIDS"></param>
/// <param name="loadOffset"></param>
void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset); void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset);
/// <summary>
/// Save prims in the xml format
/// </summary>
/// <param name="scene"> </param>
/// <param name="fileName"></param>
void SavePrimsToXml(Scene scene, string fileName); void SavePrimsToXml(Scene scene, string fileName);
/// <summary> /// <summary>
@ -54,10 +66,25 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
/// <param name="reader"></param> /// <param name="reader"></param>
void LoadPrimsFromXml2(Scene scene, TextReader reader); void LoadPrimsFromXml2(Scene scene, TextReader reader);
/// <summary>
/// Save prims in the xml2 format
/// </summary>
/// <param name="scene"></param>
/// <param name="fileName"></param>
void SavePrimsToXml2(Scene scene, string fileName); void SavePrimsToXml2(Scene scene, string fileName);
void LoadGroupFromXml2String(Scene scene, string xmlString); /// <summary>
/// Load an individual scene object from the xml2 format
/// </summary>
/// <param name="scene"></param>
/// <param name="xmlString"></param>
void LoadGroupFromXml2(Scene scene, string xmlString);
string SavePrimGroupToXML2String(SceneObjectGroup grp); /// <summary>
/// Serialize an individual scene object into the xml2 format
/// </summary>
/// <param name="grp"></param>
/// <returns></returns>
string SaveGroupToXml2(SceneObjectGroup grp);
} }
} }

View File

@ -99,12 +99,12 @@ namespace OpenSim.Region.Environment.Scenes
file.Close(); file.Close();
} }
public static string SavePrimGroupToXML2String(SceneObjectGroup grp) public static string SaveGroupToXml2(SceneObjectGroup grp)
{ {
return grp.ToXmlString2(); return grp.ToXmlString2();
} }
public static void LoadGroupFromXml2String(Scene scene, string xmlString) public static void LoadGroupFromXml2(Scene scene, string xmlString)
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
XmlNode rootNode; XmlNode rootNode;

View File

@ -112,14 +112,14 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
SceneXmlLoader.SavePrimsToXml2(scene, fileName); SceneXmlLoader.SavePrimsToXml2(scene, fileName);
} }
public void LoadGroupFromXml2String(Scene scene, string xmlString) public void LoadGroupFromXml2(Scene scene, string xmlString)
{ {
SceneXmlLoader.LoadGroupFromXml2String(scene, xmlString); SceneXmlLoader.LoadGroupFromXml2(scene, xmlString);
} }
public string SavePrimGroupToXML2String(SceneObjectGroup grp) public string SaveGroupToXml2(SceneObjectGroup grp)
{ {
return SceneXmlLoader.SavePrimGroupToXML2String(grp); return SceneXmlLoader.SaveGroupToXml2(grp);
} }
public List<string> SerialiseRegion(Scene scene, string saveDir) public List<string> SerialiseRegion(Scene scene, string saveDir)

View File

@ -1821,7 +1821,7 @@ namespace OpenSim.Region.Environment.Scenes
successYN successYN
= m_sceneGridService.PrimCrossToNeighboringRegion( = m_sceneGridService.PrimCrossToNeighboringRegion(
newRegionHandle, grp.UUID, m_serialiser.SavePrimGroupToXML2String(grp), primcrossingXMLmethod); newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod);
if (successYN) if (successYN)
{ {
@ -1854,7 +1854,7 @@ namespace OpenSim.Region.Environment.Scenes
m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor");
if (XMLMethod == 0) if (XMLMethod == 0)
{ {
m_serialiser.LoadGroupFromXml2String(this, objXMLData); m_serialiser.LoadGroupFromXml2(this, objXMLData);
SceneObjectPart RootPrim = GetSceneObjectPart(primID); SceneObjectPart RootPrim = GetSceneObjectPart(primID);
if (RootPrim != null) if (RootPrim != null)